System Design Atlas
LOCAL GUEST MODERead and practice without an account.

Your saved topics and reading progress stay in this browser. Sign in to sync supported profile and progress data.

Read-Heavy Hot Key

All copies of the hot key expire at the same instant.

○ EasyDrill 011 min1 prerequisite
My progress
Topic tools

Layout updated

Explore the design, then rehearse the decisions without looking.

Prompt

All copies of the hot key expire at the same instant.

One famous key is like one checkout counter with a long line. Add read copies and control refills so every customer does not run to the warehouse.

Constraints

  • Keep hot reads from overloading the source database.
  • State how old a cached answer is allowed to be.

Think first

Take five minutes to state the failure, the evidence you need and your first safe move.

5:00

Staged reveal

First move

The database owns writes; caches hold replaceable versioned copies.

What to check

Watch per-key request concentration, concurrent fills and source saturation.

Recovery

expiry, prewarm hot copies and refreshes; a fleet-wide average hit ratio can hide this single-key outage.

What you give up

More copies increase reads served, but also increase update work. A single write-heavy key needs a different data or admission policy.

Architecture and technical reference

High-level design

Read-Heavy Hot Key
G req->router 1. Submit request router->copies 2. Pass validated input copies->db 3. miss / refresh req Heavy Read Traffic edge router Read Router edge copies Redis / Replicated Cache Copies state · memory db PostgreSQL / Source of Truth state · durable
  • Edge
  • State

━━ Synchronous┄┄ Asynchronous···· Recovery / control▧ Fault

Select a component or follow a numbered connection.

Each arrow is one interaction. Request, background and recovery branches are not one linear transaction.

Read the 3 flow steps

Problem statement

One key receives 40% of reads while every other looks healthy. How do you add read capacity without creating conflicting writers?

Functional requirements

  • Read a popular value from several cache copies.
  • Refresh those copies when the source changes.
  • Continue serving when a cache copy fails.

Non-functional requirements

  • Keep hot reads from overloading the source database.
  • State how old a cached answer is allowed to be.

Entities

Entity / logical owner
Authoritative state

API design

Operation / inputResponse and retry contract
Decision contractIdentify acceptance, retry identity, version/ and the response on uncertainty.

High-level design component walkthrough

Client / user

Heavy Read Traffic

Skew on one key

Why, tradeoff and connected operations

An application or user-facing endpoint starts or receives this flow.

Tradeoff: High skew even if average traffic low

Connected operations: Submit request

Gateway / routing

Read Router

Detect and spread hot reads

Why, tradeoff and connected operations

Centralize admission and routing while keeping business-state ownership downstream.

Tradeoff: Routing table skew and control overhead

Connected operations: Submit request; Pass validated input

Cache / in-memory index

Redis / Replicated Cache Copies

Independent capacity per copy

Why, tradeoff and connected operations

Redis for shared ephemeral cache/index state; process-local caches remain local. Cache state is not the durable business authority. Keep frequently accessed derived state near the request path; rebuild it from its declared authority.

Tradeoff: Every update fans out to copies

Connected operations: Pass validated input; miss / refresh

Relational database

PostgreSQL / Source of Truth

Fallback and updates

Why, tradeoff and connected operations

: PostgreSQL. Relational tables and constraints own this state. Logical tables shown within the same business database are not separate databases; only at the defined transaction boundary. Use transactional constraints for related authoritative records; indexes follow the access pattern.

Tradeoff: Fallback can become bottleneck

Connected operations: miss / refresh

Engineering control room

Deep dives — decisions, failures and recovery

Open a deep dive to follow the steps, try an example and see how recovery works.

Deep dive 1

Keep one source for the current value

The database owns writes; caches hold replaceable versioned copies.

Read the explanation and worked example
How it works

Keep the source database as the only place that assigns a new value/version. Cached read copies may be created or removed according to demand, but each copy carries the source version. This lets read placement change without creating several competing write authorities.

Walk through an example

A hot product price is cached on ten servers. Updating any arbitrary cache server as if it were the owner can leave ten different prices with no rule for deciding which is valid.

Failure and recovery

Rebuild disposable copies from a trusted source version and define acceptable staleness. If the source is unavailable, only serve stale content when the product policy explicitly permits it.

Why this helps

A cache failure changes where reads run, not which copy is allowed to decide a new value.

What you give up

More copies increase reads served, but also increase update work. A single write-heavy key needs a different data or admission policy.

Deep dive 2

Recover a hot copy without flooding the source

Spread reads across healthy copies and limit replacement fetches.

Read the explanation and worked example
How it works

Spread hot reads across multiple versioned copies, combine simultaneous misses and reserve a bounded source-fetch budget. Scale using per-key concentration, not only fleet-average utilization; a single key can overload one owner while most shards remain idle.

Walk through an example

Half the traffic targets one record and one copy fails. Sending all its requests directly to the database simply moves the bottleneck to a more expensive component.

Failure and recovery

Ramp traffic toward remaining copies, refill under a concurrency limit and add temporary replicas. Test both a lost copy and simultaneous expiration, including the case where the source is also slow.

Why this helps

A cache outage should not create a database outage while the fleet is rebuilding.

What you give up

Test a value change while one copy is offline. Choose how long old data may be served and how the returning copy learns the latest version.

Deep dive 3

What happens if a region fails?

Spread surviving read copies without giving an old copy permission to write.

Read the explanation and worked example
How it works

Use regional read copies only as caches of the same source-owned version. A regional outage redistributes hot reads; it must not promote an arbitrary stale copy into a new write authority.

Walk through an example

The surviving region has plenty of cache capacity but an older price version.

Failure and recovery

Re-establish the source authority, bound origin fallback and serve stale values only where policy permits. Repopulate copies gradually while preserving version checks.

Why this helps

Read replication solves load concentration without solving regional write durability.

What you give up

More independent caches improve availability but increase freshness-management work; synchronous updates reduce staleness at a coordination cost.

Deep dive 4

Expiry, eviction and cold-start capacity

Test the cache as a finite resource, not a permanently warm lookup table.

Read the explanation and worked example
How it works

Use bounded memory and an explicit eviction policy. Add random variation to expiry, reserve a global source-read budget and combine simultaneous fills per hot key. Estimate miss traffic during a restart separately from the ordinary hit ratio.

Walk through an example

A warm fleet with a 99% hit rate restarts and almost every request becomes a miss. Even one fetch per key can exceed the database budget.

Failure and recovery

Admit refills gradually, prioritize genuinely hot keys and reject or serve approved stale values when the budget is full.

Why this helps

The source database must survive the exact cache failure the system is trying to recover from.

What you give up

Prewarming and spare capacity cost resources; waiting longer for a shared fill trades latency for reduced origin work.

Tradeoffs and alternatives

DecisionTradeoff / alternative and recovery implication
Keep one source for the current valueMore copies increase reads served, but also increase update work. A single write-heavy key needs a different data or admission policy.
Recover a hot copy without flooding the sourceTest a value change while one copy is offline. Choose how long old data may be served and how the returning copy learns the latest version.
What happens if a region fails?More independent caches improve availability but increase freshness-management work; synchronous updates reduce staleness at a coordination cost.
Expiry, eviction and cold-start capacityPrewarming and spare capacity cost resources; waiting longer for a shared fill trades latency for reduced origin work.

Production scars & failure modes

Failure investigation

All copies of the hot key expire at the same instant.

Look for: Watch per-key request concentration, concurrent fills and source saturation.

Recovery and invariant: expiry, prewarm hot copies and refreshes; a fleet-wide average hit ratio can hide this single-key outage.

Component / failureImpactRecovery mechanismAlternative / tradeoff
Primary failure / raceOne key receives 40% of reads while every other looks healthy. How do you add read capacity without creating conflicting writers?Replicate the hot read value and spread requests; preserve one write authority. Bound fallback work when a replica fails.Extra copies improve read capacity but increase invalidation . A single write-hot key needs a different semantic or rate-limit decision.
Recovery follow-upChange the value while one cache replica is disconnected. Describe version propagation, and a stale-read bound.Replicate the hot read value and spread requests; preserve one write authority. Bound fallback work when a replica fails.State the guarantee you relax and how you detect recovery.

90-second interview summary

For this hot-key drill, I would first identify the real concentration of traffic instead of assuming that a larger cache cluster automatically solves it. If half the requests target one key, ordinary key hashing still sends those reads to one owner while most shards stay idle.

The source database remains the write authority. I would replicate versioned read copies, spread requests across them and preserve the source version on every fill. Cache copies are disposable, and adding them must not create several places allowed to decide the current business value.

The failure case is more important than the warm hit ratio. A lost copy or simultaneous expiry can send a surge to the source, so I would combine concurrent fills, vary expiry, prewarm known hot values and cap global fallback work. Stale serving is allowed only for an explicit field/age policy.

Across regions, I would recover the source authority before promoting any cache into a business writer, and warm surviving copies gradually. I would measure per-key demand, refill concurrency, source saturation and stale-value age. The central tradeoff is more replication and freshness management for lower read latency, while preserving one durable version owner and a source database that survives cache failure.

Explain it without looking

Explain keep one source for the current value

Reveal answer

The database owns writes; caches hold replaceable versioned copies.

A cache failure changes where reads run, not which copy is allowed to decide a new value.

More copies increase reads served, but also increase update work. A single write-heavy key needs a different data or admission policy.

Explain recover a hot copy without flooding the source

Reveal answer

Spread reads across healthy copies and limit replacement fetches.

A cache outage should not create a database outage while the fleet is rebuilding.

Test a value change while one copy is offline. Choose how long old data may be served and how the returning copy learns the latest version.

Explain what happens if a region fails?

Reveal answer

Spread surviving read copies without giving an old copy permission to write.

Read replication solves load concentration without solving regional write durability.

More independent caches improve availability but increase freshness-management work; synchronous updates reduce staleness at a coordination cost.

Explain expiry, eviction and cold-start capacity

Reveal answer

Test the cache as a finite resource, not a permanently warm lookup table.

The source database must survive the exact cache failure the system is trying to recover from.

Prewarming and spare capacity cost resources; waiting longer for a shared fill trades latency for reduced origin work.

Revision checklist

Revision checklist

  • Reconstruct keep one source for the current value: The database owns writes; caches hold replaceable versioned copies.
  • Reconstruct recover a hot copy without flooding the source: Spread reads across healthy copies and limit replacement fetches.
  • Reconstruct what happens if a region fails?: Spread surviving read copies without giving an old copy permission to write.
  • Reconstruct expiry, eviction and cold-start capacity: Test the cache as a finite resource, not a permanently warm lookup table.
  • Name the authoritative state, boundary, retry identity and failure-domain durability guarantee.
  • Explain one alternative and exactly which guarantee you would relax.
  • Redraw the request and recovery paths without looking; mark what required a hint.

On this page
  1. Prompt
  2. Constraints
  3. Think first
  4. Staged reveal
  5. High-level design
  6. Problem statement
  7. Functional requirements
  8. Non-functional requirements
  9. Entities
  10. API design
  11. High-level design component walkthrough
  12. Engineering control room
  13. Deep dives — decisions, failures and recovery
  14. Tradeoffs and alternatives
  15. Production scars & failure modes
  16. 90-second interview summary
  17. Explain it without looking
  18. Revision checklist

Save & sync your Atlas progress

Sync your profile and topic progress across browsers, then return to the same study desk.

Google sign-in will appear here after its Azure provider is configured.

Architecture diagram