Our web-server has a worker process (w3wp.exe) that uses too much memory. Following this answer I tried to limit how much memory the process can use for caching in the web.config
:
<system.web>
<caching>
<!-- Limit cache memory -->
<cache disableExpiration="false" disableMemoryCollection="false" percentagePhysicalMemoryUsedLimit="25" privateBytesLimit="20971520" privateBytesPollTime="00:01:00" />
</caching>
<!-- rest of system.web ... -->
</system.web>
My tests show I am unable to change the EffectivePrivateBytesLimit
property of the cache by doing this. Here is how I check the cache's memory limit:
' Get cache limit
new System.Web.Caching.Cache().EffectivePrivateBytesLimit
The EffectivePercentagePhysicalMemory
of the cache does change. Why isn't EffectivePrivateBytesLimit
changing?
Sources