0

I’m configuring Output Cache on Azure using Redis as the cache store, as per the instructions here:

https://learn.microsoft.com/en-us/azure/redis-cache/cache-aspnet-output-cache-provider

I can’t work out how to limit the size of the output cache on azure. The only instructions I can find online to do thus relate to direct IIS configuration. Does anyone know how?

Mr. Flibble
  • 26,564
  • 23
  • 69
  • 100

1 Answers1

0

Please take a look at the following documentation (How to Configure Azure Redis Cache) where there is a section that discusses memory policies.

"The Maxmemory policy, maxmemory-reserved, and maxfragmentationmemory-reserved settings on the Advanced settings blade configure the memory policies for the cache."

Maxmemory policy configures the eviction policy for the cache and allows you to choose from the following eviction policies: volatile-lru - This is the default eviction policy. allkeys-lru volatile-random allkeys-random volatile-ttl noeviction For more information about maxmemory policies, see Eviction Policies.

"The maxfragmentationmemory-reserved setting configures the amount of memory in MB that is reserved to accommodate for memory fragmentation. Setting this value allows you to have a more consistent Redis server experience when the cache is full or close to full and the fragmentation ratio is high. When memory is reserved for such operations, it is unavailable for storage of cached data." "One thing to consider when choosing a new memory reservation value (maxmemory-reserved or maxfragmentationmemory-reserved) is how this change might affect a cache that is already running with large amounts of data in it. For instance, if you have a 53 GB cache with 49 GB of data, then change the reservation value to 8 GB, this change will drop the max available memory for the system down to 45 GB. If either your current used_memory or your used_memory_rss values are higher than the new limit of 45 GB, then the system will have to evict data until both used_memory and used_memory_rss are below 45 GB. Eviction can increase server load and memory fragmentation. For more information on cache metrics such as used_memory and used_memory_rss, see Available metrics and reporting intervals."

Mike Ubezzi
  • 1,007
  • 6
  • 8
  • Thanks @mike-ubezzi-msft So the method to control size is to do it at the Redis level as opposed to the Output Cache level. That is, you need to create a standalone Redis database with a size cap and let Output Cache use all of it, instead of sharing a Redis DB and telling Output Cache to only use 1GB of it (for example)? – Mr. Flibble Oct 03 '18 at 06:57