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.
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.