Question

Difficulty: Very hardImplement Azure Cache for Redis Configuration and Data Patterns

You manage a Premium tier Azure Cache for Redis instance that supports a high-throughput session state and lookup service. The cache stores two classes of data: user session tokens configured with an explicit Time-To-Live (TTL) of 20 minutes, and static configuration metadata configured without a TTL. During peak traffic events, the cache experiences high memory pressure and latency spikes due to replication synchronization overhead between the primary and replica nodes. You must configure the cache so that under memory pressure, only the user session tokens that have not been accessed recently are evicted, the static configuration metadata is never evicted automatically, and sufficient memory is reserved to accommodate replication and failover overhead. Which combination of configuration settings should you apply?

  1. Set the maxmemory-policy to volatile-lru and configure maxmemory-reserved to allocate memory for replication overhead.Answer
  2. B
    Set the maxmemory-policy to allkeys-lru and configure maxmemory-reserved to allocate memory for replication overhead.
  3. C
    Set the maxmemory-policy to volatile-ttl and configure maxfragmentationmemory-reserved to allocate memory for replication overhead.
  4. D
    Set the maxmemory-policy to noeviction and configure maxmemory-reserved to allocate memory for replication overhead.

Answer

Set the maxmemory-policy to volatile-lru and configure maxmemory-reserved to allocate memory for replication overhead.
Configuring volatile-lru ensures that the eviction algorithm only targets keys with an expiration set (which correspond to the session tokens), preserving the static metadata keys that do not have a TTL. Additionally, configuring maxmemory-reserved reserves a buffer of memory for replication, serialization, and failover operations, preventing out-of-memory errors under heavy load during synchronization.

Step-by-Step Solution

1
Analyze the eviction requirements for the different classes of data.
Identify that session tokens have a TTL and need least-recently-used eviction, whereas static configuration metadata has no TTL and must not be evicted.
This dictates that the eviction policy must only target keys with an expiration set, pointing to a volatile policy (specifically volatile-lru rather than allkeys-lru or noeviction).
2
Evaluate the difference between LRU and TTL eviction policies for keys with an expiration.
Determine that volatile-lru targets least recently used keys, whereas volatile-ttl targets keys with the shortest remaining lifetime.
The requirement specifies that tokens not accessed recently must be evicted, which requires an LRU algorithm.
3
Identify the appropriate Azure Cache for Redis configuration setting for replication overhead.
Determine that maxmemory-reserved reserves memory for non-cache operations like replication and failover, whereas maxfragmentationmemory-reserved is for memory fragmentation.
Reserving memory for replication synchronization prevents server-side OOM errors under heavy write loads.
4
Combine the selected eviction policy and reserved memory setting.
Select the configuration with volatile-lru and maxmemory-reserved.
This is the only combination that preserves the static metadata, evicts the correct session tokens, and protects the cache from replication-induced OOM failures.

Key Concept

Azure Cache for Redis Eviction Policies and Memory Management Settings
Rate this question