Last post Jul 11, 2011 01:23 PM by grantcasey
Nov 24, 2010 04:48 AM|ndjiar|LINK
I'm using HttpRuntime.Cache in my Web Application (framework 3.5 SP1) to save a DataSet. I'm always using the Insert method to update this DataSet in the Cache. Sometimes after fews minutes, my DataSet is out of the Cache ; it have been removed without
an explicit call of the HttpRuntime.Cache.Removed methode. I can follow this accidental deletion with the ReportRemovedCallBack. Until I used the property CacheItemPriority.NotRemobable, it still removed by an unknown phenomenon.
My code to insert my DataSet :
HttpRuntime.Cache.Insert(key, consigneDS, null, Cache.NoAbsoluteExpiration, new System.TimeSpan(0, 30, 0), CacheItemPriority.NotRemobable, ReportRemovedCallBack);
This Web Application is running under IIS 7.0. Nothing special in the recycling properties of the DefaultPool. The Regular Time Interval of recycling is 1740 minutes.
Please I really need some help.
Nov 24, 2010 05:17 AM|Som Nath Shukla|LINK
please check removed reason from this evenmthandller.ReportRemovedCallBack
its most probably due to memory leak on server
privateBytesLimit="number" // u have increaed this size
refer this article.
Nov 24, 2010 08:02 AM|sachingusain|LINK
ASP.NET can remove data from the cache for one of these reasons:
Because memory on the server is low, a process known as scavenging.
Because the item in the cache has expired.
Because the item's dependency changes.
To help you manage cached items, ASP.NET can notify your application when items are removed from the cache.
Here is the link:
You can be notified when an item is removed from the application cache. For example, if you have an item that takes considerable amount of processing time to create, you can be notified when it is removed from the cache so that you can replace it immediately.
As a result, the next time that the item is requested, the user does not have to wait for it to be processed.
Nov 24, 2010 08:52 AM|ndjiar|LINK
The removed reason is always Removed (whereas I do not make a specific removed of the DataSet). From this evenmthandller.ReportRemovedCallBack, I check the EffectivePercentagePhysicalMemoryLimit property wich always 99 and the EffectvePrivateBytesLimit property
wich always 10201119768. I also check the "Cache Total Trims" counter wich is always 0.
There is 16GB memory on the server and the application uses on average 2.5GB.
Nothing is declare in the web.config regarding the cache element.
Today I'am using the Performance Monitor to check the "Cache API Entries" and sometimes suddenly it decrease. As this moment I check the log file (of the application) and effectively
I see all the DataSet that are removed (thanks to evenmthandller.ReportRemovedCallBack).
Jul 11, 2011 01:23 PM|grantcasey|LINK
I'm having a similar problem. I do not call .Remove() on my cache item anywhere and yet something is removing it (as verified by checking the handler's reason.)
I am not running out of memory either, and am setting the item to NotRemovable (which i understand actually ignores the memory removal behaviour of ASP.NET - the server should instead continue until and out of memory exception is thrown which I have witnessed
before (i.e. I do get Out of Memory exceptions without my item being removed, yet sometimes for no reason the item is just removed on me.)