On my Windows Server 2008 R2 machine, I configured to use Server AppFabric Caching features.

It has a nice API which I can implement as default caching provider on my ASP.NET MVC applications.

One question I have in my mind is this: What happens when the memory runs out?

In that machine I have 4GB memory. I looked around but couldn't find anything which enables me to configure max. memory usage for AppFabric.

Any idea how should I act in this situation?


You can configure the total memory to be used for AppFabric caching on each cache host in a cluster using the Set-CacheHostConfig Powershell cmdlet. Use the CacheSize parameter (quoted in MB) e.g.

Set-CacheHostConfig -HostName MyCacheServer -CachePort 22233 -CacheSize 1024

Each cache host also has two memory thresholds, the low and high water marks, expressed as a percentage. I can't find it explicitly written down anywhere on MSDN, but I assume these are percentages of the cache size, rather than the percentage of total memory on the machine. Again, you can tune these settings with Set-CacheHostConfig.

As stated in Expiration and Eviction, once the low water mark is reached, expired objects are evicted from the cache (which to me raises the question of why they aren't evicted once they expire but that's for another day) on a Least-Recently-Used basis. If the high water mark is reached, unexpired items will be evicted until the low water mark is reached.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.