How can I exceed the 60% Memory Limit of IIS7 in ASP.NET Caching application

此生再无相见时 提交于 2020-03-21 16:06:29

问题


Pardon if this is more serverfault vs. stackoverflow. It seems to be on the border.

We have an application that caches a large amount of product data for an e-commerce application using ASP.NET caching. This is a dictionary object with 65K elements, and our calculations put the object's size at ~10GB.
Problem:

  1. The amount of memory the object consumes seems to be far in excess of our 10GB calculation.

  2. BIGGEST CONCERN: We can't seem to use over 60% of the 32GB in the server.

What we've tried so far:

In machine.config/system.web (sf doesn't allow the tags, pardon the formatting):

processModel autoConfig="true" memoryLimit="80"

In web.config/system.web/caching/cache (sf doesn't allow the tags, pardon the formatting):

 privateBytesLimit = "20000000000" (and 0, the default of course)
 percentagePhysicalMemoryUsedLimit = "90" 

Environment: Windows 2008R2 x64 32GB RAM IIS7

Nothing seems to allow us to exceed the 60% value. See screenshot of taskman.

http://www.freeimagehosting.net/image.php?7a42144e03.jpg


回答1:


A little late but I'm having nearly the same issue. The problem with the memoryLimit setting on processModel is that it just seems to have no effect despite being documented as such.

percentagePhysicalMemoryUsedLimit similarly looks like it should do something but has no effect.

privateBytesLimit="20000000000" does work though. I went and debugged the process and found the CacheMemorySizePressure object and it successfully picked up the value and set it to _memoryLimit. I would double check that.

Another option is setting a Private Memory Usage recycle threshold on the IIS app pool. That should also get picked up and override the default 60% limit.

A third option is using the new MemoryCache class and setting the PhysicalMemoryLimit on it.




回答2:


Have you considered using a different caching strategy? The in built caching is not all that feature rich and you will struggle to get it to do much more (unless some IIS guru has some clever work about).

We spent a lot of time working on this and gave up. We actually use slimmer objects to store in the cache and get the fuller objects as needed.

When we have needed to contemplate this we investigated Memcached and Velocity but retreated from deploying them just yet. They are more feature rich though.

Also how are you storing the items in the cache through code? Are you putting them in there at application start or after the first request for each? The reason I ask is whether your cache keys are effective and that actually you are populating the cache over and over and not retrieving anything (this may be the case of just one object type). We managed to do this once by appending the time to a date specific cache key for example.



来源:https://stackoverflow.com/questions/3019974/how-can-i-exceed-the-60-memory-limit-of-iis7-in-asp-net-caching-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!