473,320 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Application Cache question

Hi

The following code works on my develeopment machine using the VS web server.
When I run the application on 2 other Windows 2003/IIS 6 servers no caching
seems to take place at all. Can someone explain what I might be doing wrong
or what to look out for? What's the differece between IIS and VS web server?
The IIS servers seem to have enough memory.

public DataTable GetAll()
{
DataTable dt;

// try to retrieve item from cache
dt = (DataTable)_context.Cache[_cacheKeyName];

if (dt == null)
{
dt = tableAdapter.GetAll();
_context.Cache.Insert(_cacheKeyName, dt, null, Cache.NoAbsoluteExpiration,
TimeSpan.FromSeconds(600));
}
return dt;
}
Many thanks

Andrew
Sep 3 '07 #1
5 2251
Hi Andrew,

From your description, you have an ASP.NET 2.0 application which use cache
to store objects. You found the application work fine on dev machine(in VS
2005 Test server) but can not persist cache on product server(win2k3 iis),
correct?

Based on the code snippet you provided, I think the code logic should be
correct and as you mentioned it work on dev machine, therefore, the problem
is likely due to the deployment environment. Of course, there is no
particular limitation on Application cache between IIS hosted and VS 2005
test server enviornment. Would you tried the following things to further
simplify the issue?

** Create a new empty project and add a simple page to dedicated on using
cache to store objects(you can try both small objects and large objects)

** In the windows performance counters, you can add the ASP.NET cache
related counters(such as "CACHE API Entries" ) under the "ASP.NET APPs
V2.0....." category.

If the problem can be even reproted through such as simple project, it will
make the problem much clearer.

If you have any other finding, please also feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>From: "J055" <j0**@newsgroups.nospam>
Subject: Application Cache question
Date: Mon, 3 Sep 2007 20:11:53 +0100
Hi

The following code works on my develeopment machine using the VS web
server.
>When I run the application on 2 other Windows 2003/IIS 6 servers no
caching
>seems to take place at all. Can someone explain what I might be doing
wrong
>or what to look out for? What's the differece between IIS and VS web
server?
>The IIS servers seem to have enough memory.

public DataTable GetAll()
{
DataTable dt;

// try to retrieve item from cache
dt = (DataTable)_context.Cache[_cacheKeyName];

if (dt == null)
{
dt = tableAdapter.GetAll();
_context.Cache.Insert(_cacheKeyName, dt, null,
Cache.NoAbsoluteExpiration,
>TimeSpan.FromSeconds(600));
}
return dt;
}
Many thanks

Andrew
Sep 4 '07 #2
Hi Steven

I can see that small objects seem to work. It doesn't really help me because
on the development machine large objects work too.

On the main server that seems to be having problems I watched some of the
performance counters you suggested. The object I'm attempting to cache is a
Dictionary<int, stringwith around 20 entries.

Cache API Entries: 0 - 2 (mostly 0)
Cache API Hit Ratio: 51.638
Cache API Hits: 268
Cache API Misses: 251

I'm afraid though that I have no idea how to interpret these figures. Does
it suggest anything to you?

Thanks again
Andrew

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:0z**************@TK2MSFTNGHUB02.phx.gbl...
Hi Andrew,

From your description, you have an ASP.NET 2.0 application which use cache
to store objects. You found the application work fine on dev machine(in VS
2005 Test server) but can not persist cache on product server(win2k3 iis),
correct?

Based on the code snippet you provided, I think the code logic should be
correct and as you mentioned it work on dev machine, therefore, the
problem
is likely due to the deployment environment. Of course, there is no
particular limitation on Application cache between IIS hosted and VS 2005
test server enviornment. Would you tried the following things to further
simplify the issue?

** Create a new empty project and add a simple page to dedicated on using
cache to store objects(you can try both small objects and large objects)

** In the windows performance counters, you can add the ASP.NET cache
related counters(such as "CACHE API Entries" ) under the "ASP.NET APPs
V2.0....." category.

If the problem can be even reproted through such as simple project, it
will
make the problem much clearer.

If you have any other finding, please also feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.


--------------------
>>From: "J055" <j0**@newsgroups.nospam>
Subject: Application Cache question
Date: Mon, 3 Sep 2007 20:11:53 +0100
Hi

The following code works on my develeopment machine using the VS web
server.
>>When I run the application on 2 other Windows 2003/IIS 6 servers no
caching
>>seems to take place at all. Can someone explain what I might be doing
wrong
>>or what to look out for? What's the differece between IIS and VS web
server?
>>The IIS servers seem to have enough memory.

public DataTable GetAll()
{
DataTable dt;

// try to retrieve item from cache
dt = (DataTable)_context.Cache[_cacheKeyName];

if (dt == null)
{
dt = tableAdapter.GetAll();
_context.Cache.Insert(_cacheKeyName, dt, null,
Cache.NoAbsoluteExpiration,
>>TimeSpan.FromSeconds(600));
}
return dt;
}
Many thanks

Andrew

Sep 5 '07 #3
Hi

I've done a little more research. I understand the counter stats better now.
I checked the data being retrieved from SQL Server and it's around 15,000
Bytes (133 rows), it gets pulled into a DataTable then a Dictionary. I guess
that has little to do with why the caching doesn't work so well.

The settings are to use sliding expiration for 5 minutes. Even though the
hit ratio is 50% (which I think is bad anyway), the cache seems to be
cleared almost immediately most of the time.

When I recycle the IIS App pool the cache seems to work better for a few
minutes and then degrades again shortly after.

I'd like to cache a lot more objeects in the application but I need to
undertstand what this problem is first. Any ideas?

Thanks
Andrew
Sep 6 '07 #4
Thanks for your reply Andrew,

Yes, for the counters, the "CACHE API Entries" can help indicate the cache
items added the user(exclude the ones added by system), you can check it to
see whether the number matches the items your code have added.

As you said the DataTable object is around 15,000 Bytes, is your
application frequently caching such objects? If so, it may produce some
memory pressure. You can have a look at the EventLog to see whether there
is entry indicate the ASP.NET worker process has recycled frequently or
whether the ASP.NET application is restarting constantly. Application
Restart may cause the Cache objects lost. BTW, is it possible to repro
the same problem through a very simple project with a single page to cache
some large datatables(you may use code to manually create some datatable
objects for test). If so, you can also send me the project and let me
perform some local test.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "J055" <j0**@newsgroups.nospam>
References: <ef**************@TK2MSFTNGP03.phx.gbl>
<0z**************@TK2MSFTNGHUB02.phx.gbl>
<#A**************@TK2MSFTNGP04.phx.gbl>
>Subject: Re: Application Cache question
Date: Thu, 6 Sep 2007 12:59:39 +0100
>
Hi

I've done a little more research. I understand the counter stats better
now.
>I checked the data being retrieved from SQL Server and it's around 15,000
Bytes (133 rows), it gets pulled into a DataTable then a Dictionary. I
guess
>that has little to do with why the caching doesn't work so well.

The settings are to use sliding expiration for 5 minutes. Even though the
hit ratio is 50% (which I think is bad anyway), the cache seems to be
cleared almost immediately most of the time.

When I recycle the IIS App pool the cache seems to work better for a few
minutes and then degrades again shortly after.

I'd like to cache a lot more objeects in the application but I need to
undertstand what this problem is first. Any ideas?

Thanks
Andrew
Sep 7 '07 #5
Hi Andrew,

Have you got any progress on this? I'm still monitoring on this issue and
would like to check the issue status with you.

Also, based on the nature of this problem, it may not be quite easy and
efficient to troubleshoot through newsgroup communication. Therefore, if
this is an urgent issue, I would suggest you consider contact CSS phone
support directly. Anyway, if you need continual help from us, please feel
free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Organization: Microsoft
Date: Fri, 07 Sep 2007 03:33:59 GMT
Subject: Re: Application Cache question
>Lines: 55
Path: TK2MSFTNGHUB02.phx.gbl
Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet:41489
NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122

Thanks for your reply Andrew,

Yes, for the counters, the "CACHE API Entries" can help indicate the cache
items added the user(exclude the ones added by system), you can check it
to
>see whether the number matches the items your code have added.

As you said the DataTable object is around 15,000 Bytes, is your
application frequently caching such objects? If so, it may produce some
memory pressure. You can have a look at the EventLog to see whether there
is entry indicate the ASP.NET worker process has recycled frequently or
whether the ASP.NET application is restarting constantly. Application
Restart may cause the Cache objects lost. BTW, is it possible to repro
the same problem through a very simple project with a single page to cache
some large datatables(you may use code to manually create some datatable
objects for test). If so, you can also send me the project and let me
perform some local test.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>>From: "J055" <j0**@newsgroups.nospam>
References: <ef**************@TK2MSFTNGP03.phx.gbl>
<0z**************@TK2MSFTNGHUB02.phx.gbl>
<#A**************@TK2MSFTNGP04.phx.gbl>
>>Subject: Re: Application Cache question
Date: Thu, 6 Sep 2007 12:59:39 +0100
>>
Hi

I've done a little more research. I understand the counter stats better
now.
>>I checked the data being retrieved from SQL Server and it's around 15,000
Bytes (133 rows), it gets pulled into a DataTable then a Dictionary. I
guess
>>that has little to do with why the caching doesn't work so well.

The settings are to use sliding expiration for 5 minutes. Even though the
hit ratio is 50% (which I think is bad anyway), the cache seems to be
cleared almost immediately most of the time.

When I recycle the IIS App pool the cache seems to work better for a few
minutes and then degrades again shortly after.

I'd like to cache a lot more objeects in the application but I need to
undertstand what this problem is first. Any ideas?

Thanks
Andrew

Sep 11 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: Davey | last post by:
I am planning on developing an application which will involve skills that I have very little experience of - therefore I would appreciate comments on my initial design thoughts. Overview on...
4
by: Keith Chadwick | last post by:
I am having some trouble referencing an Application("myVar") variable from within a module.vb file on my ASP.NET site. According to the documentation I should be able to reference...
5
by: stefano mostarda | last post by:
Hi there, I have a question. In my application I have a table which is frequently used to fill a combo. I want to store it in the application or cache object. it is never updated. What's...
3
by: spammy | last post by:
hi all, im currently writing an ASP.net front end to display data found in an XML file. the XML file is quite large (700k or so), and so takes a while to load. it will be changing around every...
7
by: Greg Collins [MVP] | last post by:
Hi, I couldn't find what I was looking for by searching the newsgroup, but perhaps these have already been discussed somewhere. This is a bit long with a lot of interrelated questions. What I've...
5
by: Darrel | last post by:
I thought this warranted a new thread. Yesterday I asked about access relatively static content...is it better to read from the DB, or just grab a text file. It was suggested that I use the DB...
4
by: Fred Nelson | last post by:
Hi: This is probably a newby question however I can't figure it out! I'm trying to use application data caching in a web application. I have read an article on 4 guys from rolla that shows...
2
by: LeAnne | last post by:
My question is to do with scalability and the location for storate of cache, session, viewstate and application data. Application - Data is stored in memory (in process) Session - Data is stored...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.