473,748 Members | 3,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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)_con text.Cache[_cacheKeyName];

if (dt == null)
{
dt = tableAdapter.Ge tAll();
_context.Cache. Insert(_cacheKe yName, dt, null, Cache.NoAbsolut eExpiration,
TimeSpan.FromSe conds(600));
}
return dt;
}
Many thanks

Andrew
Sep 3 '07 #1
5 2276
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**@newsgroup s.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)_con text.Cache[_cacheKeyName];

if (dt == null)
{
dt = tableAdapter.Ge tAll();
_context.Cache. Insert(_cacheKe yName, dt, null,
Cache.NoAbsolut eExpiration,
>TimeSpan.FromS econds(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.comw rote in message
news:0z******** ******@TK2MSFTN GHUB02.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**@newsgroup s.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)_con text.Cache[_cacheKeyName];

if (dt == null)
{
dt = tableAdapter.Ge tAll();
_context.Cache. Insert(_cacheKe yName, dt, null,
Cache.NoAbsolut eExpiration,
>>TimeSpan.From Seconds(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**@newsgroup s.nospam>
References: <ef************ **@TK2MSFTNGP03 .phx.gbl>
<0z************ **@TK2MSFTNGHUB 02.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.publi c.dotnet.framew ork.aspnet:4148 9
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**@newsgroup s.nospam>
References: <ef************ **@TK2MSFTNGP03 .phx.gbl>
<0z*********** ***@TK2MSFTNGHU B02.phx.gbl>
<#A*********** ***@TK2MSFTNGP0 4.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
2850
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 system: I'm not going to divulge the exact aims of the application but the purpose of it is to allow multiple client applications to retrieve data from a database (on a db server) and feed this data into another Windows
4
1661
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 System.Web.HttpApplication but it does not seem to like that one bit. I also have a MSXML2.DOMDocument30 defined as a public object within the vb module which is loaded during the application start up with a bunch of XML. What is weird is that the data contained...
5
1395
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 the besta container to improve performance and scalability, Cache or Application object?
3
1537
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 second, so needs to be loaded at least at that rate. at the moment, the ASP application loads the xml every refresh - im thinking that this may cause problems when there are 20 clients each refreshing once per second. the solution im thinking of...
7
2167
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 got is a decodeImage.aspx page that gets called to decode base64 encoded images and return them as displayable images to a Web page. The ASPX page is passed two parameters, "file" and "img". The "file" parameter specifies and XML file on the Web...
5
1734
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 and look into the Application Cache settings. I found a good article here: http://www.developer.com/net/net/article.php/1477771
4
3469
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 the following syntax: Write: Cache = value;
2
1950
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 in memory (in process or out of process) - can be configured to store the session data in sql server (which relates to my question) ViewState - Page (but can be modified to overwrite the storage mechanism to store viewstate else where, esp...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.