Redis 8 OOM memory troubleshooting starts by separating Redis write rejections, key eviction, and an operating-system OOM kill; do not respond to all three by raising maxmemory. That limit applies to Redis-managed memory, not the full process or host budget. Set it only after comparing the real dataset, process RSS, workload peaks, and any persistence or replication overhead. Choose an eviction policy only after deciding whether the affected data can be rebuilt.
This guide is for DBAs investigating Redis write errors or memory alerts, backend engineers setting cache limits, and technical leads assessing server capacity. It focuses on evidence and repeatable checks, not on assuming a particular memory size will fit.
Which failure happened: rejection, eviction, or process termination?
Treat the client symptom, Redis counters, and host process state as separate evidence. A rising memory alert does not, by itself, tell you which layer reached a limit.
- Redis rejects a write: Capture the exact client error and check the configured
maxmemoryandmaxmemory-policy. Redis can reject writes when it cannot satisfy the command under its memory limit and eviction policy. Confirm the configured behavior against the Redis eviction documentation; do not infer it from an alert label alone. - Redis evicts keys: Check the
evicted_keyscounter inINFO statsand compare it over the same period as application errors and cache hit behavior. Eviction means Redis removed keys under the configured policy; it does not establish that the operating system killed the process. The INFO command reference documents the information sections and their fields. - The process exits or disappears: Check service logs, kernel logs, and the process supervisor’s status around the incident. On a Linux host using cgroup v2, inspect the relevant cgroup’s
memory.events, including its OOM-related counters. A cgroup limit or host-level memory pressure can terminate a process independently of Redis’s ownmaxmemorysetting; see the kernel cgroup v2 memory documentation and the kernel OOM handling documentation.
Does a Redis OOM error mean the host ran out of memory?
No. A Redis error is evidence of a Redis command being refused, while a kernel OOM event points to operating-system memory enforcement. Verify both layers before changing a limit. If the service is still running and Redis counters are available, record those before restarting it; a restart can erase useful in-memory evidence.
A key eviction is not automatically a data-loss incident. It may be an expected cache action, but it is a serious issue if the key contains a session, queue item, or other state the application cannot reconstruct.
What do used_memory, RSS, and maxmemory actually tell you?
Use each memory field to answer a different question. Redis INFO memory is a measurement snapshot, not a single “available memory” number. Its fields help distinguish Redis-managed allocations from the process’s resident footprint. The official INFO reference is the source of truth for the fields exposed by the running version.
| Evidence | What it helps establish | What it does not establish |
|---|---|---|
maxmemory |
The Redis memory limit currently configured for the instance | A safe limit for the whole host |
used_memory |
Memory Redis reports as allocated through its allocator | Total process RSS or all host memory in use |
used_memory_dataset |
The dataset portion of Redis memory | Full process overhead or the amount of host memory available |
used_memory_rss |
The resident set reported for the Redis process | A direct replacement for used_memory or a guaranteed amount of reclaimable memory |
mem_not_counted_for_evict, when exposed |
Memory the running version reports as not counted for eviction decisions | A complete capacity plan for persistence, replication, and other host processes |
evicted_keys |
Whether keys have been evicted, when compared across observations | Whether the application can tolerate those evictions |
Why do used_memory and RSS differ?
They describe different views of memory. Redis reports allocator-related usage, while RSS reflects resident pages attributed to the process. Allocator behavior, process memory layout, and work such as persistence can make the figures diverge. Use both: used_memory helps evaluate Redis’s own accounting and limit, while RSS helps evaluate the process against host or container capacity. Neither value alone represents the full memory budget. The INFO reference defines the Redis fields; the kernel’s cgroup v2 documentation explains the separate control-group accounting layer.
Take observations at meaningful points: during steady traffic, near the workload peak, and while a persistence or replication operation is active if your deployment uses one. Save timestamps alongside the output. A one-off snapshot taken after traffic has subsided may miss the condition that caused the alert.
Step 1: Capture configuration and memory evidence
Before editing configuration, capture the current settings and counters. Run the checks against the affected instance, and preserve the output outside that instance so a restart does not erase the incident record.
redis-cli INFO memory
redis-cli INFO stats
redis-cli INFO persistence
redis-cli INFO clients
redis-cli CONFIG GET maxmemory maxmemory-policy
Compare maxmemory and maxmemory-policy with the memory fields and eviction counters. INFO persistence helps establish whether persistence activity coincided with the incident; INFO clients provides context for connection-related memory use. Check the output against the version’s documented fields rather than relying on a dashboard label or a copied command result from another environment.
Next, record host evidence at the same time:
- Check whether the Redis process is still running and whether the service manager recorded a restart or failure.
- Review kernel logs for OOM messages and determine whether the event names a cgroup or process.
- If Redis runs in a container, check the memory limit and
memory.eventsfor that container’s cgroup. A container limit can be lower than the host’s physical memory. - Record memory use from other processes on the same host. Redis does not have the entire machine available if it shares resources with other services.
These checks create a baseline. Without synchronized Redis and host observations, it is easy to misdiagnose a Redis limit as a host shortage or to attribute an operating-system kill to key eviction.
Step 2: Set maxmemory from workload evidence, not total RAM
What should determine a Redis maxmemory value?
Start with the memory used by the representative working set, then account for process RSS, host services, workload peaks, and features that add memory pressure. Do not set the Redis limit equal to installed RAM or to the current used_memory reading. The host still needs room for the operating system and other processes, and Redis process memory can exceed the part governed by eviction.
Build the estimate from observations rather than a fixed percentage:
- Measure the dataset during ordinary load and during a representative peak. Include the key types and value-size distribution that the application actually creates.
- Record connected-client behavior and any modules enabled in the deployment. Treat their resource use as workload-specific; do not assume a result from a different module set or container image applies.
- Check whether persistence or replication is active during the period you are sizing. Redis documents persistence operations and their memory implications in its persistence guide. Replication and persistence buffers can affect memory needs and eviction accounting, so assess the active configuration rather than adding an arbitrary allowance.
- Compare Redis memory fields with process RSS and the host or cgroup limit. Leave space for processes outside Redis and for temporary peaks that appear in your own measurements.
- Repeat observations under the peak behavior the service must support. If the available host or cgroup headroom is not sufficient, reduce workload pressure, isolate the Redis process, or provision more capacity before increasing the Redis limit.
The Redis eviction guide explains how maxmemory and eviction policies work together, including memory that is not counted in the eviction decision. Check the documentation for the running release and verify the fields in INFO memory; the amount and behavior should not be guessed from a fixed formula.
Step 3: Choose an eviction policy that matches the data
An eviction policy is an application behavior, not just a memory setting. For a cache whose values can be regenerated, eviction may be an acceptable way to stay within the planned Redis limit. Validate that the application can rebuild missing values and that the resulting cache misses do not overload the backing service.
For mixed workloads, do not assume that an all-keys eviction policy is safe. A Redis instance may contain cache entries alongside sessions, queue data, locks, or other state. If the application cannot tolerate losing a key, decide whether that workload belongs in a separate instance or a storage system with suitable durability and recovery controls. If a policy refuses writes rather than evicting keys, establish how the application handles that refusal and whether clients retry safely.
What should you inspect when evicted_keys rises?
Compare the counter across a defined interval, then check the configured policy, maxmemory, working-set growth, cache hit and miss behavior, and the application’s response to missing keys. A rising counter can be expected for a deliberately bounded cache, or it can signal that the working set has outgrown its budget. The counter alone cannot tell which case applies.
If you change runtime settings, record the old values and the change time. Redis documents CONFIG SET as a way to change supported configuration parameters at runtime; consult the CONFIG SET command reference for the parameter’s behavior. Also verify how the change will be retained after a restart in the deployment’s configuration process. A successful runtime change is not proof that the persisted service configuration has changed.
Step 4: Reproduce the peak and verify the change
Test changes in an isolated environment before applying them to production. Use representative key shapes, expiry behavior, connection patterns, and write bursts. A synthetic test that inserts uniform values may not reproduce the memory profile of real application data.
Use a before-and-after record with the same observation points:
- Redis configuration:
maxmemoryandmaxmemory-policy. - Redis memory:
used_memory,used_memory_dataset,used_memory_rss, and any applicable eviction-accounting field. - Redis behavior: changes in
evicted_keys, client-visible write errors, and application cache hit or miss behavior. - Host behavior: process status, cgroup memory events, and the memory headroom available to other processes.
- Workload state: whether persistence, replication, or a traffic peak was active during the measurement.
Keep the test long enough to cover the behavior that triggered the incident, but do not treat a single successful run as a capacity guarantee. If the test avoids persistence while production uses it, it is testing a different memory profile. If production has bursty writes, include a representative burst rather than extrapolating from an idle snapshot.
Use this checklist before accepting a change:
- [ ] The exact client error or process failure has been captured and classified.
- [ ] Redis memory fields and host or cgroup evidence were recorded at matching times.
- [ ] The configured
maxmemoryandmaxmemory-policymatch the intended behavior. - [ ] The test uses representative data, connections, and peak write patterns.
- [ ] Persistence and replication activity have been included if production uses them.
- [ ] The application team has confirmed whether evicted keys are safe to rebuild.
- [ ] A rollback value and a way to detect renewed errors or eviction growth are documented.
- [ ] Any data requiring recovery has an off-host backup and a tested restore procedure.
If the test still produces a Redis write rejection, determine whether the policy, workload, or budget is responsible before raising the limit. If the process is killed while Redis appears below its configured limit, investigate the cgroup or host ceiling and other resident processes. The next action depends on the evidence, not on the word “OOM” in an alert.
Turn the measured peak into a server decision
Size an instance from the peak you measured, not from a memory target chosen in isolation. Add the process and host requirements revealed by the test, and account for whether Redis shares a machine with an application, monitoring agent, or other data service. If the workload cannot meet its memory budget without risking important keys, separate cacheable data from state that must be preserved.
A server change does not make Redis data safe by itself. Replication can help with availability, but it is not an off-host backup. Local disk redundancy can help with some device failures, but it does not protect against every operational error or provide a tested recovery path. For durable data, define backup retention outside the Redis host and rehearse restoration. Keep cache rebuild procedures separate from database backup responsibilities.
A shared cloud instance may be sufficient when the workload is light, short-lived, or needs rapid elastic changes. It may be a poor fit when sustained memory pressure, shared CPU behavior, or unclear resource boundaries make repeatable capacity planning difficult. A dedicated AMD bare-metal server is worth comparing when Redis needs a stable, isolated host and the team is prepared to manage the operating system, Redis configuration, monitoring, and recovery. IronStp lists current server options and billing details on its dedicated server pricing page; compare those published details with the measured workload rather than buying capacity from a guessed cache size. For broader purchase trade-offs, see the guide to buying or renting a dedicated server.
Before any purchase or resize, assemble the INFO memory snapshot, process RSS, eviction trend, host or cgroup evidence, and the peak-test record. That evidence turns a vague memory alert into a resource requirement and helps distinguish a Redis limit problem from a host-capacity problem. If the measured profile calls for dedicated resources, compare it with IronStp’s current server options; if the cache is small or temporary, correcting the policy and workload may be the more appropriate fix.
Further reading
Give Redis 8 Dedicated Memory Headroom
Choose an IronStp dedicated server with 128GB or 256GB of ECC memory for your workload.