Redis maxmemory Calculator
maxmemory caps how much data Redis keeps before it starts evicting keys — for a cache, it's the
setting that trades hit rate against memory cost. The Redis process needs more than maxmemory,
though: fragmentation, client buffers and the fork used for snapshots all sit on top of it. This calculator
sizes maxmemory from observed usage and tells you how much memory to give the host or container.
01 Usage data
Where do I get these numbers?
With redis_exporter, use a range query over a representative period (a week is a good default):
redis_memory_used_bytes{instance="redis:6379"}
Or sample Redis directly and paste the lines:
while sleep 60; do redis-cli INFO memory | grep '^used_memory:'; done
Enter observed used_memory directly, in MiB.
02 Workload profile
Advanced: margins and defaults
Values the result relies on that are our own defaults, or vendor defaults your setup may change. Each “?” says how one moves the result; the guide says where it comes from.
03 Sizing gauge
04 redis.conf
—
05 How this was derived
How every number is calculated, with sources and assumptions (opens in a new tab) ↗
Result looks wrong? Report it
maxmemory and provisioning in short
maxmemory is the most memory Redis uses for data; past it Redis applies the eviction policy. allkeys-lru evicts the least recently used keys, while noeviction returns errors for writes at the limit. Buffers for replication and the AOF don't count towards maxmemory, so Redis can use somewhat more. Redis docs
The calculator sizes maxmemory from the peak used_memory plus a margin, with a floor from the average. The margins are MemoryLimit's own defaults, changeable under Advanced. It writes allkeys-lru, taking this Redis to be a cache.
It also tells you how much memory to give the process: in a write-heavy application Redis can use up to twice its normal memory while it saves an RDB file or rewrites the AOF, so the calculator provisions 2 × maxmemory. Without persistence or replication it suggests about 1.25 ×. Redis docs
Common input mistakes
- Using
allkeys-lrufor data you can't lose: usenoeviction, so writes fail at the limit instead. - Provisioning only
maxmemory: in a write-heavy application the process can need up to twice that while it saves an RDB file or rewrites the AOF. - Setting
maxmemoryequal to the memory you have: Redis advises setting it below the free memory, to leave room for its overhead and fragmentation.
Full derivation, warnings and every assumption: how the Redis calculator works. The shared formula and margin tables: the sizing model.
Related calculators: