One Redis key is read about 50,000 times per second while being rewritten only occasionally, and it is saturating the node that owns it. You are considering adding read replicas of that Redis master so reads can be served from them. Work through the capacity arithmetic: what does each added replica actually buy you for that one key, what would change if the same key were write-hot instead of read-hot, and how does the cost per unit of relief compare with splitting the entry into several suffixed Redis keys or putting a sub-second in-process cache in front of Redis?
answer
- N replicas ≈ (N+1)x read budget — own core, own NIC
- First ceiling: value size x rps (20 KB x 50k ≈ 1 GB/s)
- Write-hot gains nothing; master ships every write to every replica
- Replica = whole dataset copy per read unit; splitting = K copies of one value
- 200 ms near cache on 40 instances = 200 rps total
basics
~20 sEach replica is a separate process with its own core and network link, so N replicas roughly multiply read capacity for that one key. Check egress first: value size times reads per second. A write-hot key gains nothing and adds master work. A near cache is far cheaper.
solid answer
~60 sA replica holds a full copy, so the hot key lives on every replica and reads spread over independent cores and NICs: with N replicas the read budget for that key is roughly (N+1)x. (The mechanics — cluster clients must send `READONLY`, and replication is asynchronous so replica reads can be stale — belong to the replication topic; see `db-redis-replication-async-stale-replica-reads`.) Do the arithmetic first. The usual ceiling is egress, not CPU: **value size x rps**. A 20 KB value at 50k rps is ~1 GB/s, already past a 10 Gb NIC, so you need four or five serving nodes just for bandwidth — and halving the value size halves the whole problem. Replicas relieve reads only. A write-hot key gets nothing: writes still funnel to one master, and that master must now ship every write to every replica, so replicas *add* master egress. Cost per unit of relief: a replica buys read capacity at the price of a whole extra dataset copy plus a host; key splitting duplicates only that one value across K keys; a 200 ms near cache caps each app instance at 5 GET/s for free. Try near cache, then splitting, then replicas.
go deeper
Know the core fact: replicas are extra copies that can answer reads, so more replicas mean more read capacity for the same key — and writes still all go to one master.
Be able to do the arithmetic out loud: (N+1)x read budget, and egress = value size x rps as the first ceiling. Explain why a write-hot key gains nothing from replicas.
Compare options by cost per unit of relief — near cache, key splitting, replicas — measure which resource is actually saturated before adding nodes, and name shrinking the value as the highest-leverage fix.
Frame it as a capacity and money decision: what each unit of read relief costs in RAM, hosts and operational surface; when replicas are justified by availability requirements you already have; and how you would re-measure after each change because the binding ceiling moves.
## What the replica actually buys for one key A Redis master executes commands on a single core and answers them over one network interface. A hot key's throughput ceiling is therefore the ceiling of exactly one node. A replica is a separate Redis process, normally on a separate host, holding a full copy of the dataset — so the hot key is present on it, and any read it answers consumes *its* core and *its* NIC rather than the master's. That gives the arithmetic: with one master and N replicas able to serve reads, the read budget for that single key is roughly (N+1) times a single node's budget. It scales linearly and it changes nothing about your key names or data model — only read routing. The connection-level mechanics (cluster clients must issue `READONLY`, and because replication is asynchronous a replica read can return a slightly older value) are owned by the replication topic — see `db-redis-replication-async-stale-replica-reads` — and are not re-derived here. ## Size the ceiling before you size the fleet People reach for replicas assuming CPU is the limit. For a hot key it usually is not. Compute egress first: **bytes/sec = value size x reads per second** - 20 KB value x 50,000 rps = ~1 GB/s = ~8 Gb/s of application payload, before protocol and TCP overhead. A 10 Gb NIC is already at its practical limit; a 1 Gb NIC was exceeded 8x ago. - The same 50,000 rps against a 200-byte value is 10 MB/s — nowhere near a NIC, so there the limit really is command CPU (and the fix might just be pipelining or fewer round trips). So for the 20 KB case you need roughly four to five serving nodes for bandwidth alone, and each additional replica adds one NIC's worth of headroom. Note what the same formula implies about the cheapest lever: shrink the value. Trimming a 20 KB blob to 4 KB (drop unused fields, compress, split the document so callers fetch only what they need) removes 80% of the problem without buying a single machine, and every other technique then works on a smaller number. A second ceiling worth checking is per-connection and per-client fan-out: thousands of clients each polling the key also cost accept/read syscalls and output-buffer memory on the serving node, which replicas divide the same way. ## Why a write-hot key gains nothing — and loses a little All writes for a key go to the single master that owns it; replicas are read-only copies. So if your hot key is a counter being `INCR`ed 50,000 times a second, adding replicas gives zero relief on the hot path. Worse, the master must propagate every write to every replica. Master replication egress is approximately: **write rate x propagated size x number of replicas** For a large value rewritten often this dominates: a 1 MB value rewritten 10 times a second across 5 replicas is ~50 MB/s of pure replication traffic leaving the master, competing with the client traffic you were trying to protect. Each replica also costs the master a client buffer and, on (re)connection, a full sync that briefly consumes CPU, disk and bandwidth. A write-hot key needs a different family of fixes — sharding the write across suffixed keys and summing on read, or aggregating in the application and flushing periodically — not replicas. ## Cost per unit of relief, compared Rank the three options by relief bought per dollar and per unit of operational complexity: - **Sub-second in-process (near) cache.** Each application instance holds the value locally with, say, a 200 ms TTL. Its Redis read rate for that key collapses to 5 GET/s regardless of user traffic; 40 instances produce 200 rps total instead of 50,000 — a ~250x cut for zero new infrastructure. The price is bounded staleness of one TTL and per-instance memory. Highest leverage by a wide margin, and it composes with everything else. - **Key splitting / suffix sharding.** Write the same value under K suffixed keys and have each reader pick one; because the suffixes hash to different slots they can land on different masters, so you get up to Kx read capacity *and* it relieves write pressure when writes are sharded too. Memory cost is only K copies of that one value, not K copies of the dataset. The price is application logic, a fan-out on invalidation (you must expire all K), and skew if suffixes collide onto the same shard. - **Read replicas.** Each unit of read capacity costs a full copy of the *entire* dataset in RAM plus a host, even though you only wanted more throughput on one key. You also must size for N-1, because a replica can be promoted and leave the read pool. Replicas earn their keep when you wanted the availability anyway, when the value genuinely cannot be held in-process, or when the read pressure is spread over so many keys that a per-key trick is impractical. A defensible order of attack for a read-hot key: shrink the value, add a short-TTL near cache, split the key, then add replicas — and re-measure `value size x rps` after each step, because the ceiling moves.
- You add four replicas for a read-hot key and throughput barely improves. What would you check?Confirm reads are actually reaching the replicas rather than all landing on the master — check the per-node ops rate, not the cluster aggregate — since a misconfigured client read preference sends everything to the primary. Then recompute value size x rps against each node's NIC: if a single copy of the value already saturates a link, four replicas move the ceiling only 4x and you may still be under water. Also look for one client library, proxy hop or connection pool funnelling everything through one node.
- When would you still choose replicas over a 200 ms in-process cache even though the near cache is cheaper?When the value cannot tolerate a stale window even that short, or when correctness depends on all instances seeing the same version at once. Also when the read pressure is not concentrated on a handful of keys but spread over a large working set, so per-key tricks don't generalize — and when you wanted the replicas for failover capacity anyway, in which case the read relief is essentially free.
- How do you decide K when splitting a hot key into suffixed copies?Start from the deficit: required rps divided by what one node can actually serve for that value size, then round up and add headroom for skew, since suffixes hash to slots and may not land on distinct masters. Keep K small enough that the write-side fan-out (writing and invalidating all K copies) stays cheap, and verify placement by checking which node owns each suffixed key rather than assuming an even spread.
A replica is a photocopy of a wildly popular book: N copies let N people read at once, but every correction to the text has to be re-copied into all N, so a book being constantly edited gets slower to maintain, not faster to read.
saying these in an interview costs you the question
- Claiming read replicas relieve a write-hot key, when writes still funnel to one master
- Forgetting that the master must ship every write to every replica, so replicas add master egress rather than reducing it
- Sizing by CPU only and never computing value size x rps, missing that the NIC is the real ceiling
- Treating a replica as cheap read capacity while ignoring that it costs a full copy of the whole dataset plus a host
- Buying replicas before the two cheaper levers: shrinking the value and a sub-second in-process cache