Empower growth and innovation with the latest Program Dev insights

Ops says Redis memory is only at 60%, but a batch of users was kicked back to the login page this morning—is adding memory now still in time?

Nov 29, 2026 Read: 6

Conclusion: Memory looks like it is only 60% used, yet users are being kicked back to the login page in batches. In most cases this is not because capacity was underestimated; it is because the eviction policy is deleting sessions. volatile-lru only picks keys with TTL, and sessions happen to have TTL, so during cache write peaks the login state is evicted first. Based on common 2026 delivery experience, check maxmemory-policy and the growth rate of evicted_keys first, then TTL distribution and big keys, and only then discuss scaling. Adding memory now can stop the bleeding, but it usually only pushes the recurrence out by a few weeks.

1. Memory Has Headroom but Logins Still Drop—First Find Out What Was Deleted

maxmemory is judged per instance or per node, not for the whole cluster. In a cluster, as long as one or two shards hit the limit first, sessions that land on those shards will be evicted, while the overall utilization on the monitoring dashboard may be only 60%. Session keys are often distributed by hashing the user identifier; the shard that hits the limit happens to correspond to a group of users, which shows up as one group being logged out at the same time while another group feels nothing.

Another commonly overlooked number is evicted_keys. It is a cumulative value in info stats, so you cannot see a single action, but as long as this number is rising, Redis is deleting something. What gets deleted is determined by maxmemory-policy: when configured as allkeys-*, it does not distinguish by type; when configured as volatile-*, it deletes only keys with expiration time. The policy itself is not wrong; the mistake is that sessions and cache share the same set of rules.

  • Session key loss: Users log in again, flows such as payment and ordering that were halfway through are interrupted, and complaints concentrate.
  • Cache key loss: Back-to-origin pressure rises, and API latency goes from tens of milliseconds to hundreds of milliseconds.
  • Lock and queue key loss: May cause duplicate execution and uncontrolled concurrency, which is harder to troubleshoot than being logged out.

2. Four Steps That Can Characterize the Problem Without Scaling

This order has been used repeatedly in projects; its value is to characterize first and spend money later. If the order is reversed and memory is added before looking, it is easy to cover up the root cause with a single sentence: not enough memory.

  1. Check the policy: Confirm whether it is noeviction, allkeys-*, or volatile-*, and whether session keys actually have TTL.
  2. Check the growth rate of evicted_keys: Take two differences per minute to see whether eviction is continuous or intermittent; continuous eviction is mostly genuinely tight capacity.
  3. Check TTL distribution and big keys: Sample and count the proportion with and without expiration; a single value of a few MB—lists, sets, full-page HTML caches—a few of them can consume considerable memory and also slow down eviction sampling.
  4. Estimate the growth rate: Roughly estimate with peak QPS × average value size × retention time, compare it with the peak used_memory, and see whether the gap is an order of magnitude or just at the limit.

What counts as clear enough: you can state which policy is deleting, which key prefix is being deleted, and which write points the growth comes from. If you cannot say these three things, do not place an order to add memory yet.

3. If Expiration Times Are Not Jittered, Adding Memory Only Moves the Explosion Point Later

A large number of keys expiring in the same second causes concentrated deletion plus concentrated back-to-origin in a short period. On monitoring it looks like a stutter every minute, like network jitter, but in reality the TTLs are too neatly aligned. The approach is to add random offset to cache TTLs; the experience range is 5%–15% above and below the base duration. For scenarios like sessions that expire based on activity, change to sliding renewal, which is closer to the real usage rhythm than writing a single absolute time uniformly.

  • Use sliding renewal for session TTL, with a typical range of 30 minutes to 2 hours, determined by the business activity rhythm.
  • Add random offset to cache TTL to avoid batch invalidation on the hour; for hot keys, add a local cache layer to absorb the load.
  • Keys without TTL must have a stated reason; if there is no reason, add expiration time or attach a periodic cleanup task.

4. Scaling, Changing Policy, Splitting Instances—How Do Cost and Timeline Compare?

The three approaches are not mutually exclusive; priority depends on whether the growth source is controllable. If the curve climbs slowly and capacity is only at the limit, scaling is easier. If the curve jumps in steps, it is mostly because a feature wrote keys without TTL after launch; changing the code first is more cost-effective than adding machines.

  • Scaling (add memory or add nodes): Cost rises linearly with the specification, with an experience range of half a day to two days. It only solves insufficient total capacity, not uncontrolled growth; suitable when growth has converged and capacity alone is tight.
  • Changing the eviction policy and adding TTL: Cost is mainly troubleshooting and canary validation, with an experience range of two to three days to one week. The risk is the impact scope of policy switching, so a rollback plan is needed.
  • Splitting instances (separate sessions, cache, and queues): Medium cost, with an experience range of one to three weeks, including configuration changes, dual-write transition, and regression validation. It is a one-time investment with long-term benefits, suitable for systems where multiple businesses share one Redis.

The trade-off in typical ranges is: for systems where sessions and cache share one instance and there are obvious write peaks, the stability benefit of splitting is usually more tangible than repeated scaling. Conversely, for systems with only thousands of online sessions and single-instance memory consistently below 50%, adding TTL and adjusting policy is enough; there is no need to split instances for that.

5. On-Site Handling When Only Configuration Was Changed and No Machines Were Added

A common on-site situation: two weeks before a major promotion, the budget does not approve new instances, only configuration and code can be changed, and the window is only three days. The approach was not to add memory. First, move session keys to a separate database with a different prefix; change the eviction policy from allkeys-lru to volatile-lru; add TTL with random offset to campaign caches; and add a daily big-key sampling script (sample with scan, not keys). The result was that peak memory dropped from the limit to around 70%, and no batch login drops occurred during the observation period. There were costs too: some historical report caches were cleared, and the first back-to-origin made the list slow for more than ten seconds, so operations had to be notified in advance. On the day of policy switching, watch evicted_keys and slow queries; the experience range is generally 24 to 48 hours of observation before considering it stable. Such changes are written into the launch checklist to avoid someone switching back to default configuration after a handover.

6. These Cases Apply; In These Cases, Do Not Suspect Redis First

Set the boundary first: if login drops are concentrated on individual users, or only occur on the same device or the same network, do not think of Redis first. Check the session cookie domain and SameSite settings, and whether front-end local storage was cleared. The characteristic of eviction-caused problems is that a group of users are logged out at the same time within the same time window, regardless of device and network.

  • Suitable for troubleshooting in the order of this article: Sessions are stored in Redis, cache and sessions share one instance, memory utilization is consistently above 70%, and login drops are clustered in batches.
  • Can avoid heavy measures: For systems with low daily request volume, thousands of online sessions, and single-instance memory consistently below 50%, adding TTL and a policy is enough.
  • Recommend planning ahead: For businesses with obvious write peaks such as campaigns, flash sales, and batch imports, separate sessions and cache into different instances and write the eviction policy into the configuration baseline.

Frequently Asked Questions

Can Redis eviction cause this even when there is not a single error in the business logs?

Yes. Eviction is an internal Redis action and does not go into business logs; it can only be seen from rising evicted_keys and session keys not being found. On the application side, it usually only shows as being unable to read the session and being redirected to the login page.

If the policy is changed to noeviction, are sessions preserved?

Not necessarily. Under noeviction, when memory is full, write commands directly return OOM, and new logins cannot be written. The problem changes from occasional login drops to overall login failure; in production this configuration is generally not recommended.

If session keys have no expiration time, will they not be evicted?

Sessions without TTL are indeed not selected by volatile-* policies, but they will continuously occupy memory and push eviction pressure onto cache keys. It is recommended to use sliding renewal instead, with a typical range of 30 minutes to 2 hours.

If it is full again a few weeks after scaling, is the solution itself flawed?

In most cases, no. Scaling only raises total capacity; if growth comes from keys without TTL or accumulation of big keys, based on the experience range it will hit the limit again in a few weeks to one or two months. TTL must be added at the same time, and capacity should be counted by prefix.


When batch login drops happen again, it is recommended to act in this order: check the eviction policy and the growth rate of evicted_keys, count the proportion of keys without TTL, investigate big keys, and roughly estimate the growth rate. Decide whether to scale or change policy only after these four results are available. If the business has obvious write peaks and sessions and cache share one instance, prioritize a window for instance splitting; do not wait until the day before a major promotion to adjust parameters temporarily.

Have a similar project in mind?
Contact us for a one-to-one project reference proposal
Obtain Proposal
Interested in this topic?
10-year tech team — reference proposal within 24 hours
Obtain Proposal
Are you ready?
Then reach out to us!
+86-13370032918
Discover more services, feel free to contact us anytime.
Please fill in your requirements
What services would you like us to provide for you?
Your Budget
ct.
Our WeChat
Professional technical solutions
Phone
+86-13370032918 (Manager Jin)
The phone is busy or unavailable; feel free to add me on WeChat.
E-mail
349077570@qq.com
Submitted successfully
Thank you for your trust. We will contact you soon!
Recommended projects for you