How should I set maxmemory-reserved and maxfragmentmemory-reserved in the Redis Cache?

ZP@Gyrus 30 Reputation points
2025-02-25T20:45:56.0633333+00:00

Hi. I'm dealing with a web app that is having issues with it's Redis Cache, so my company's IT team is wanting me to inquire as to whether increasing the maxmemory-reserved and the maxfragmentationmemory-reserved settings under our Redis Cache Advanced settings would help. In other words, how would we determine the best settings to set here?Max Memory Advanced Settings

Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
274 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mallaiah Sangi 90 Reputation points Microsoft External Staff
    2025-02-25T21:24:20.0533333+00:00

    Hi @ZP@Gyrus

    Thanks for the Question and using Microsoft Q&A

    As per my understanding, setting up maxmemory-reserved and maxfragmentmemory-reserved in the Redis Cache for better performance.

    Memory policies:

    Use the Maxmemory policy, maxmemory-reserved, and maxfragmentationmemory-reserved settings from Advanced settings from the Resource menu on the left to configure the memory policies for the cache. When you create a cache, the values maxmemory-reserved and maxfragmentationmemory-reserved default to 10% of maxmemory, which is the cache size.

    find the below link for better understanding of Memory configuration.

    https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-configure?tabs=access-keys

    maxmemory-reserved setting configures the amount of memory in MB per instance in a cluster that is reserved for noncache operations, such as replication during failover. Setting this value allows you to have a more consistent Redis server experience when your load varies. This value should be set higher for workloads that write large amounts of data. When memory is reserved for such operations, it's unavailable for storage of cached data. The minimum and maximum values on the slider are 10% and 60%, shown in megabytes. You must set the value in that range.

    maxfragmentationmemory-reserved setting configures the amount of memory in MB per instance in a cluster that is reserved to accommodate for memory fragmentation. When you set this value, the Redis server experience is more consistent when the cache is full or close to full and the fragmentation ratio is high. When memory is reserved for such operations, it's unavailable for storage of cached data. The minimum and maximum values on the slider are 10% and 60%, shown in megabytes. You must set the value in that range.

    When choosing a new memory reservation value (maxmemory-reserved or maxfragmentationmemory-reserved), consider 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 drops 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 has 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.

    I hope this information helps. Please do let us know if you have any further queries.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.