Databases Azure Managed Redis verified

Redis eviction

Redis eviction is what happens when Redis needs room and starts throwing away keys. It is not random cleanup, and it is not a backup feature. The cache follows its eviction policy, TTLs, and memory pressure signals to decide what can be removed. A healthy application expects some cached data to disappear and can rebuild it from a system of record. Problems start when teams store session state, carts, or coordination data in Redis and assume eviction will never touch it.

Aliases
No aliases mapped yet
Difficulty
intermediate
CLI mappings
5
Last verified
2026-05-21

Microsoft Learn

Redis eviction is the Redis behavior that removes keys when memory pressure reaches the configured limit. Azure Managed Redis and Azure Cache for Redis expose eviction through memory policies, TTL behavior, metrics, and diagnostics so teams can decide which cached data may disappear safely.

Microsoft Learn: Memory management for Azure Managed Redis2026-05-21

Technical context

In Azure architecture, Redis eviction sits in the data plane of Azure Managed Redis or Azure Cache for Redis. It appears when used memory approaches the maxmemory boundary for the selected SKU, shard, or database. Redis then removes eligible keys based on the configured policy, key TTLs, and workload pattern. Operators connect eviction analysis with memory metrics, cache misses, application latency, database fallback load, clustering, high availability, and the difference between ephemeral cache data and authoritative data stored elsewhere.

Why it matters

Redis eviction matters because it is often the first visible symptom of a cache that has outgrown its design. A few evicted keys might be harmless for product-page fragments, but dangerous for sessions, rate-limit counters, deduplication tokens, or workflow state. Eviction can shift traffic back to databases, increase latency, and create confusing reports of data loss. It also tests whether developers really designed Redis as a cache rather than a hidden database. When operators understand eviction, they can tune TTLs, scale capacity, adjust key patterns, or change the eviction policy before memory pressure becomes a production incident. That decision protects users and backend capacity.

Where you see it

Signals, screens, and Azure surfaces where this term usually becomes operational.

Signal 01

Azure Monitor charts show evicted key counts rising near high used memory percentage, often beside latency spikes, cache misses, or database fallback traffic during peak demand.

Signal 02

Redis INFO output shows evicted_keys under the Stats section, helping operators distinguish memory pressure from key expiration or client delete commands during incidents today.

Signal 03

Application logs expose sudden cache misses for hot keys, repeated recomputation, session resets, or backend calls immediately after Redis memory crosses capacity thresholds during user traffic.

When this becomes relevant

Specific situations where this term helps solve real Azure design, operations, migration, security, reliability, cost, or governance problems.

  • Diagnose disappearing cache entries when users report lost sessions, stale carts, or recomputed data during peak traffic.
  • Decide whether a workload needs larger Redis capacity, shorter TTLs, better key cleanup, or a different eviction policy.
  • Separate harmless cache churn from dangerous loss of state that should have lived in a durable database.
  • Tune memory alerts before backend systems are overwhelmed by misses after hot keys are evicted.
  • Investigate whether a bad deployment or abusive client is filling Redis with large, unbounded keys.

Real-world case studies

Different enterprise-style examples that show the term being used to hit measurable objectives.

Case study 01

Ticketing platform stops session loss during concert launches

Scenario, objectives, solution, measured impact, and takeaway.

Scenario

A live-event ticketing platform used Redis for seat holds, queue position hints, and checkout session fragments. During major concert launches, users saw vanished reservations when memory pressure evicted keys.

Business/Technical Objectives
  • Keep checkout-related cache misses below five percent during launch peaks.
  • Identify which key families were unsafe for eviction.
  • Reduce user-visible seat-hold resets without overbuying cache capacity.
  • Create a repeatable incident dashboard for Redis memory pressure.
Solution Using Redis eviction

Engineers mapped Redis eviction to the exact key prefixes used by queueing, seat holds, and page fragments. Disposable page-fragment keys stayed in Redis with short TTLs, but seat-hold state moved to Azure SQL with Redis used only as a fast lookup layer. Azure Monitor tracked used memory percentage, evicted keys, cache misses, and SQL fallback traffic in one workbook. CLI scripts captured SKU, maxmemory policy, region, and resource IDs before each launch. The team also added guards that rejected new unbounded key patterns in deployment checks, then tested a cold-cache surge with synthetic launch traffic.

Results & Business Impact
  • Checkout cache misses fell from 19 percent to 3.8 percent during the next high-demand sale.
  • Seat-hold reset complaints dropped by 71 percent because authoritative state no longer depended on Redis survival.
  • The team avoided an immediate SKU jump by removing 11 GB of stale fragment keys.
  • Incident review time fell from four hours to under one hour with CLI-backed evidence.
Key Takeaway for Glossary Readers

Redis eviction becomes manageable when teams separate disposable cache entries from business state that must survive memory pressure.

Case study 02

Weather analytics service protects model cache during storm season

Scenario, objectives, solution, measured impact, and takeaway.

Scenario

A climate analytics provider cached expensive forecast model fragments in Redis for municipal emergency teams. Storm-season traffic caused eviction of hot forecast keys, forcing slow recomputation during urgent briefings.

Business/Technical Objectives
  • Keep p95 forecast API responses under 300 milliseconds during regional storms.
  • Identify large key families that drove memory pressure.
  • Protect the hottest forecast fragments without storing every historical scenario.
  • Reduce database and compute spikes caused by cache misses.
Solution Using Redis eviction

The platform team treated Redis eviction as a capacity-design signal instead of a simple cache alert. They used INFO samples and Azure Monitor metrics to correlate evicted keys with model fragment size, TTL settings, and compute workload. Large historical fragments moved to Azure Blob Storage, while Redis kept only current regional forecasts, short-lived alerts, and small lookup tables. Engineers changed TTLs by forecast class, scaled Redis one tier for storm regions, and added cache-warm jobs that preloaded high-risk counties. CLI output was archived before and after each policy or SKU change for operational comparison.

Results & Business Impact
  • P95 forecast latency dropped from 1.4 seconds to 240 milliseconds during the first storm drill.
  • Evicted keys declined by 86 percent after removing oversized historical fragments.
  • Compute burst cost fell by 28 percent because fewer model fragments were recomputed.
  • Emergency briefing dashboards stayed available through three consecutive peak-traffic events.
Key Takeaway for Glossary Readers

Eviction analysis is valuable because it exposes which cached data is too large, too stale, or too important to be left unmanaged.

Case study 03

Fleet optimization team avoids backend overload from cold caches

Scenario, objectives, solution, measured impact, and takeaway.

Scenario

A logistics company used Redis to cache route plans and delivery-window calculations for thousands of drivers. After a routing update, eviction surged and overloaded the optimization API behind the cache.

Business/Technical Objectives
  • Keep driver dispatch pages responsive during morning route recalculation.
  • Detect whether eviction came from code changes or normal traffic growth.
  • Prevent cache misses from overwhelming the route optimization API.
  • Document a rollback path for memory-policy and TTL changes.
Solution Using Redis eviction

Operators compared Redis eviction metrics with deployment timestamps and found a new key prefix storing oversized route alternatives without TTLs. The team added expiration logic, capped payload size, and moved archived route alternatives to Azure Data Lake Storage. Redis kept only active driver routes and near-term dispatch calculations. Azure CLI collected the current maxmemory policy, cache SKU, tags, and metric window for the change ticket. Application teams added backpressure so optimization requests queued instead of stampeding when hot keys were missing. A validation workbook tracked evicted keys, API p95 latency, and driver app errors.

Results & Business Impact
  • Morning dispatch p95 latency improved from 2.2 seconds to 410 milliseconds.
  • Route optimization API retries dropped by 64 percent after TTL and payload fixes.
  • Redis memory use stabilized below 72 percent during peak dispatch periods.
  • The rollback checklist reduced future memory-policy review time by 55 percent.
Key Takeaway for Glossary Readers

Redis eviction often reveals a hidden application design problem, not just a cache capacity problem.

Why use Azure CLI for this?

Azure CLI is useful for Redis eviction because the evidence needs to be repeatable during incidents. I use CLI to capture cache configuration, SKU, region, maxmemory policy, and resource IDs before asking developers to change code or operators to scale. Portal charts are useful, but command output can be pasted into incident records and compared across environments. CLI also helps me check whether eviction is caused by policy, capacity, firewall isolation, or a recent update. After ten years of Azure operations, I trust scripted evidence more than screenshots when memory pressure is moving quickly.

CLI use cases

  • Inspect the active Redis resource, SKU, region, provisioning state, and maxmemory policy before diagnosing evicted keys.
  • Query Azure Monitor metrics for evicted keys and used memory percentage during the suspected incident window.
  • Compare staging and production Redis configuration when eviction appears only in one environment.
  • Scale the cache or adjust memory policy after approval, then capture JSON output for rollback evidence.
  • Export affected resource IDs, tags, and metric timestamps for a post-incident capacity review.

Before you run CLI

  • Confirm tenant, subscription, resource group, Redis cache or cluster name, database name, and whether the target is Azure Managed Redis or Azure Cache for Redis.
  • Use read-only show and metric commands first because scaling or changing memory policy can affect cost, cache behavior, and application latency.
  • Check that Microsoft.Cache is registered and that your identity has permission to read metrics, inspect configuration, and update Redis only when approved.
  • Know the incident window, region, SKU, output format, and relevant key families so command results can be tied to actual user impact.
  • Coordinate with application and database owners because eviction fixes can shift traffic patterns or require backend capacity during validation.

What output tells you

  • The redisConfiguration or evictionPolicy field shows which keys Redis may remove when memory pressure appears.
  • Used memory percentage and evicted key metrics show whether eviction lines up with capacity pressure or another cause.
  • SKU, shard count, region, and provisioning state tell you whether capacity changes are possible and currently complete.
  • Resource IDs and tags identify the owning team, environment, and billing scope for incident evidence.
  • Metric timestamps help prove whether a deployment, traffic spike, or configuration change triggered eviction.

Mapped Azure CLI commands

Redis eviction CLI Commands

adjacent
az redis show --name <cache-name> --resource-group <resource-group> --query "{sku:sku,policy:redisConfiguration.maxmemory-policy,location:location,provisioningState:provisioningState}"
az redisdiscoverDatabases
az redis update --name <cache-name> --resource-group <resource-group> --set "redisConfiguration.maxmemory-policy"="allkeys-lru"
az redisconfigureDatabases
az redisenterprise database show --cluster-name <cluster-name> --resource-group <resource-group> --query "{evictionPolicy:evictionPolicy,provisioningState:provisioningState}"
az redisenterprise databasediscoverDatabases
az monitor metrics list --resource <redis-resource-id> --metric "Used Memory Percentage" --start-time <utc-start> --end-time <utc-end>
az monitor metricsdiscoverDatabases
az resource show --ids <redis-resource-id> --query "{id:id,tags:tags,location:location}"
az resourcediscoverDatabases

Architecture context

A seasoned Azure architect treats Redis eviction as a capacity and data-classification decision. Before approving a workload, I want to know which keys are allowed to disappear, which keys have TTLs, which backend rebuilds them, and how the application behaves during a cold-cache surge. The design should align SKU size, clustering, maxmemory reservations, persistence, high availability, and monitoring. Eviction is acceptable for disposable cache entries; it is a red flag for authoritative state unless the business has approved that risk. The architecture should also explain whether eviction pressure is caused by growth, large values, poor expiration hygiene, fragmentation, or write spikes.

Security

Security impact is indirect but real. Eviction can remove authorization hints, throttling counters, anti-fraud markers, or temporary session data that security controls expect to exist. It can also hide misuse when attackers or buggy clients flood Redis with large keys and force important keys out of memory. Access to change memory policy, flush data, or scale capacity should be limited through Azure RBAC and Redis access controls. Operators should keep TLS enabled, avoid exposing public endpoints unnecessarily, and monitor evicted keys alongside unusual write volume so memory pressure does not become a quiet security bypass. Review these keys during threat modeling exercises.

Cost

Cost impact is usually indirect, but it can become expensive quickly. Eviction pressure may push a team to a larger Redis SKU, more shards, or Enterprise capacity. It can also increase backend database reads, Log Analytics volume, incident labor, and customer-facing performance penalties. Cheap cache sizing looks attractive until eviction forces every request back to SQL, Cosmos DB, or an API during peak traffic. FinOps owners should track memory utilization, key count growth, large object patterns, and cache-miss consequences. The right answer may be better TTL discipline, not simply buying a larger cache. Capacity decisions should reference real key growth.

Reliability

Reliability impact is direct because eviction changes what the application can read from Redis under pressure. If the cache is designed correctly, eviction produces cache misses and controlled rebuilds. If the cache is overloaded or used as a state store, eviction can cause lost user sessions, repeated work, failed idempotency checks, or backend storms. Reliable designs define acceptable eviction rates, alert on memory pressure, test behavior with warm and cold caches, and keep fallback systems sized for bursts. Zone redundancy and replicas help availability, but they do not stop eviction when the memory model is wrong. Document ownership before production traffic depends on Redis.

Performance

Performance impact is direct. Eviction occurs when memory is constrained, so the cache may spend more work removing keys while the application sees more misses. Those misses send requests to slower systems of record and can turn one memory problem into a database latency problem. Large values, high write rates, fragmentation, and aggressive expiration patterns can make the issue worse. Performance testing should measure p95 and p99 latency with realistic key churn, not just happy-path cache hits. Monitor evicted keys, used memory percentage, server load, and backend query volume together. Warmup plans should be tested after scaling. Include realistic payload sizes in tests.

Operations

Operators inspect Redis eviction by combining Azure Monitor metrics, Redis INFO output, application logs, and recent deployment changes. They look for rising used memory, evicted key counts, large values, missing TTLs, fragmentation, and sudden cache misses. Operational response might include scaling up, shortening TTLs, changing key naming, splitting workloads, adjusting the eviction policy, or fixing a client that writes unbounded data. Good runbooks record the cache name, SKU, region, maxmemory policy, latest memory trend, and affected key families before changing anything. Afterward, teams verify latency, database load, and error rates. They should also preserve samples of key prefixes and TTL coverage for later comparison.

Common mistakes

  • Treating Redis eviction as harmless cleanup while storing sessions, locks, or idempotency markers that users depend on.
  • Changing the eviction policy without checking which keys actually have TTLs and which keys are safe to remove.
  • Scaling Redis after every eviction alert instead of fixing unbounded key growth, large values, or missing expirations.
  • Looking only at application errors and missing the matching evicted key and used memory metrics.
  • Assuming replicas, zones, or persistence prevent eviction when the cache memory limit is still being reached.