# How much memory does Redis need? Sizing an ElastiCache node

Source: https://systemdesignsim.com/learn/redis-memory-size

Learn

Redis needs your key and value bytes plus about 85 bytes of overhead per key: 100 million short links with 7-byte codes and 100-byte URLs take about 19.2 GB. Caching only the hottest 20% takes 3.84 GB, which fits on one cache.r7g.large for about $128 a month.

A cache that's too small quietly stops working: it evicts the keys you need and your database takes the load again. Sizing one is mostly arithmetic: how many keys, how big each one is, how much overhead Redis adds, and how much memory AWS keeps back.

Updated October 9, 2026 · 4 min read

## How big should your cache be?

1. 10M × (20 + 200 bytes) = **2.20 GB** of data
2. \+ about 85 bytes of Redis overhead per key = **3.05 GB** in memory
3. ElastiCache keeps 25% of each node in reserve, so you can use 75% of its RAM

The smallest node that holds it is **cache.r7g.large** (9.8 GiB usable) for about **$128/month**.

| Node              | RAM       | Usable   | Nodes | Per month |
| ----------------- | --------- | -------- | ----- | --------- |
| cache.t4g.micro   | 0.5 GiB   | 0.4 GiB  | 8     | $75       |
| cache.t4g.small   | 1.37 GiB  | 1.0 GiB  | 3     | $56       |
| cache.t4g.medium  | 3.09 GiB  | 2.3 GiB  | 2     | $76       |
| cache.r7g.large   | 13.07 GiB | 9.8 GiB  | 1     | $128      |
| cache.r7g.xlarge  | 26.32 GiB | 19.7 GiB | 1     | $255      |
| cache.r7g.2xlarge | 52.82 GiB | 39.6 GiB | 1     | $510      |

[Run this design in the playground]()

Approximate AWS on-demand prices for us-east-1, read once in October 2026, before free tiers. They may be out of date; check the AWS pricing pages before you budget. [How we calculate this](https://systemdesignsim.com/methodology)

## Step 1: count keys and their size

Start with what you'll store: how many keys, how long the keys are, and how big each value is. For a URL shortener, a key might be a 7-character short code and the value a 100-byte URL. For sessions, a 36-byte ID and a few hundred bytes of JSON.

**Raw data = keys × (key size + value size).**

## Step 2: add Redis's per-key overhead

Redis stores more than your bytes: every key carries pointers, metadata and hash-table space. The [Redis FAQ](https://redis.io/docs/latest/develop/get-started/faq/) gives a concrete figure: *"1 Million small Keys -> String Value pairs use \~ 85MB of memory"* on a 64-bit instance, and an empty instance uses about 3 MB. For small keys that's roughly 85 bytes each, so a good estimate is:

**Memory ≈ keys × (key + value + 85 bytes).**

When values are small, overhead dominates. Grouping many small fields into one hash uses much less memory than one key per field, as Redis's own [memory optimization guide](https://redis.io/docs/latest/operate/oss_and_stack/management/optimization/memory-optimization/) shows.

## Step 3: leave room for ElastiCache's reserve

ElastiCache doesn't let your data fill the node. By default it keeps [25% of memory in reserve](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/redis-memory-management.html) for replication buffers, fragmentation and background saves, and AWS advises 30% on small nodes and 50% on micro nodes. So a 13 GiB node holds about 10 GiB of data. Plan with the usable figure, not the advertised one.

## Step 4: size for the hot data, not all of it

A cache doesn't need everything, only what's read often. Traffic is usually skewed: a small share of keys gets most of the reads. Size for that, and let Redis evict the rest. The [eviction docs](https://redis.io/docs/latest/develop/reference/eviction/) call `allkeys-lru`"a good default option" when some keys are read far more than others, and it's more memory-efficient than relying on expiry.

A common starting point is the hottest 20% of a day's reads. Then watch the hit ratio: if it falls as your data grows, the cache is too small.

## Worked example: 100 million short links

|                                  | All links                    | Hottest 20%                 |
| -------------------------------- | ---------------------------- | --------------------------- |
| Keys                             | 100M                         | 20M                         |
| Raw data (7 + 100 bytes each)    | 10.7 GB                      | 2.14 GB                     |
| With \~85 bytes overhead per key | 19.2 GB                      | 3.84 GB                     |
| Smallest single node             | cache.r7g.xlarge, $255/month | cache.r7g.large, $128/month |

Caching only the hot fifth cuts the node you need, and the bill, sharply. The cold links fall through to the database.

## ElastiCache node sizes

| Node                | vCPU | Memory    | Usable (75%) | Per month |
| ------------------- | ---- | --------- | ------------ | --------- |
| `cache.t4g.micro`   | 2    | 0.5 GiB   | 0.4 GiB      | $9        |
| `cache.t4g.small`   | 2    | 1.37 GiB  | 1.0 GiB      | $19       |
| `cache.t4g.medium`  | 2    | 3.09 GiB  | 2.3 GiB      | $38       |
| `cache.r7g.large`   | 2    | 13.07 GiB | 9.8 GiB      | $128      |
| `cache.r7g.xlarge`  | 4    | 26.32 GiB | 19.7 GiB     | $255      |
| `cache.r7g.2xlarge` | 8    | 52.82 GiB | 39.6 GiB     | $510      |

Prices are for ElastiCache for Valkey, which AWS prices 20% below Redis OSS on node-based clusters.

## When one node isn't enough

* **Too much data:** cluster mode splits keys across several primaries, each holding part of the data.
* **Availability:** add a replica per shard, so a node failure fails over instead of emptying the cache.
* **Throughput:** rarely the limit. A single node handles tens to hundreds of thousands of simple operations per second; a published benchmark measured about 205,000 on an r7g.2xlarge without I/O threads. Memory runs out first.

See what happens when a cache restarts empty in [The Stampede](https://systemdesignsim.com/challenges/the-stampede) challenge, or put one in front of a struggling database in [Cache Money](https://systemdesignsim.com/challenges/cache-money).

## Frequently asked questions

### How much memory does Redis use per key?

More than the key and value alone. The Redis FAQ says 1 million small key-value pairs use about 85 MB on a 64-bit instance, which works out to roughly 85 bytes each for very small keys. For estimates, add about 85 bytes of overhead to the size of each key and value.

### What is reserved memory in ElastiCache?

ElastiCache reserves part of each node's memory for replication buffers, fragmentation and background saves. The default reserved-memory-percent is 25%, so a 13 GiB node stores about 10 GiB of data. AWS suggests 30% on small nodes and 50% on micro nodes.

### What happens when Redis runs out of memory?

It depends on the eviction policy. With allkeys-lru, Redis evicts the least recently used keys to make room, which suits a cache. With no eviction policy, it starts rejecting writes.

### Do I need to cache all my data?

No. Traffic is usually skewed: a small share of keys gets most of the reads. A common starting point is to size the cache for the hottest 20% of a day's reads, then watch the hit ratio and grow if it drops.

## Sources

* [ElastiCache: managing reserved memory for Valkey and Redis OSS](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/redis-memory-management.html)
* [Amazon ElastiCache pricing](https://aws.amazon.com/elasticache/pricing/)
* [Redis FAQ: memory footprint](https://redis.io/docs/latest/develop/get-started/faq/)
* [Redis key eviction policies](https://redis.io/docs/latest/develop/reference/eviction/)

The calculator's sizes, limits and prices come from the simulator's catalogue: [how we calculate this](https://systemdesignsim.com/methodology).

[Now run the numbersChallenge: Cache MoneyYour database is at 95% utilization serving reads it has answered a thousand times. Cool it down below 50%.Start the challenge →](https://systemdesignsim.com/challenges/cache-money)[GuideDesign a URL ShortenerThe interview walkthrough, with a design you can run.](https://systemdesignsim.com/system-design/url-shortener)

## One system design problem a week

A real scenario, its constraints, and where the obvious design breaks.

## Now break one yourself.

The first challenge takes about two minutes. No signup.

[Design your first system](https://systemdesignsim.com/challenges/hello-load-balancer)
