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.

Hot-Key Write Propagation

Version 12 arrives before version 11 at one cache replica.

◐ MediumDrill 041 min2 prerequisites
My progress
Topic tools

Layout updated

Explore the design, then rehearse the decisions without looking.

Prompt

Version 12 arrives before version 11 at one cache replica.

A cache update is a delayed announcement of a newer fact. Announcements can arrive twice or in the wrong order.

Constraints

  • Reject a cache update older than the installed version.
  • Keep deletes effective despite delayed updates.

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 source assigns versions and each cache rejects older replacements.

What to check

Record the highest applied version and invalidation backlog.

Recovery

Reject regressing updates, preserve versioned deletes and repair from authoritative state; message arrival order is not the data version.

What you give up

Keeping version barriers uses memory. Rechecking the source gives stronger freshness but increases read cost and dependency on the source.

Architecture and technical reference

High-level design

Hot-Key Write Propagation
G writer->owner 1. Persist state owner->evt 2. Publish event evt->replicas 3. Consume work reader->replicas 4. Pass validated input writer Writer compute owner PostgreSQL / Authoritative DB/Leader state · durable evt → Kafka / Invalidation Event Bus messaging replicas Redis / Replicated Caches state · memory reader Reader compute
  • Compute
  • State
  • Messaging

━━ 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 4 flow steps

Problem statement

A read of version 7 starts before a write of version 8. The invalidation reaches the cache before the slow read fills it. What happens?

Functional requirements

  • Update or delete a value at its source.
  • Send the new version to cached copies.
  • Ignore updates older than the installed version.

Non-functional requirements

  • Reject a cache update older than the installed version.
  • Keep deletes effective despite delayed updates.

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

Backend service

Writer

Update value

Why, tradeoff and connected operations

Isolate this operation so it can scale and fail independently from storage.

Tradeoff: Concurrent writers reorder events

Connected operations: Persist state

Relational database

PostgreSQL / Authoritative DB/Leader

monotonic version

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: Leader / cost per version

Connected operations: Persist state; Publish event

Queue / event stream

Kafka / Invalidation Event Bus

Fan out version updates

Why, tradeoff and connected operations

Kafka retained partitioned stream. Key events by the domain ordering key; replay and independent consumers motivate this choice. rows remain in the source database; a relay publishes after commit. Buffer independent producers and consumers, with bounded and replay semantics.

Tradeoff: Out-of-order or missed invalidations

Connected operations: Publish event; Consume work

Cache / in-memory index

Redis / Replicated Caches

Reject stale version

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: Stale reads until copies converge

Connected operations: Consume work; Pass validated input

Backend service

Reader

Check current data

Why, tradeoff and connected operations

Isolate this operation so it can scale and fail independently from storage.

Tradeoff: Freshness check costs a lookup

Connected operations: Pass validated input

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

Let source versions decide which update wins

The source assigns versions and each cache rejects older replacements.

Read the explanation and worked example
How it works

The source transaction assigns a monotonic data version. Every cache retains a minimum version that may be installed. Updating that minimum and accepting a candidate value must be one cache operation, otherwise two writers can race around the check.

Walk through an example

Invalidation 8 arrives between checking a version-7 fill and storing it. A separate check followed by SET still permits stale resurrection.

Failure and recovery

Keep the comparison at the cache owner and distinguish data version from a server's wall-clock timestamp. Clock skew must not make an older mutation appear newer.

Why this helps

Network arrival order can differ from the order in which the source committed changes.

What you give up

Keeping version barriers uses memory. Rechecking the source gives stronger freshness but increases read cost and dependency on the source.

Deep dive 2

Repair missed or reordered updates

Reject old fills and replay durable changes from the source.

Read the explanation and worked example
How it works

Publish invalidations or replacement values from durable source intent. Consumers ignore duplicate or regressing versions and periodically reconcile gaps against the authority. A short-lived event notification can reduce latency, but it cannot be the only record of a required state change.

Walk through an example

A cache replica misses invalidation 8 and later receives an old version-7 fill. The version floor or must detect that it is behind before accepting the value.

Failure and recovery

Preserve delete barriers through the stale-work window and rebuild lagging replicas when history is missing. Verify behavior under reordered delivery, consumer restart and cache process loss.

Why this helps

A crash can happen between any two delivery steps; one missed notification cannot be the only record of a required update.

What you give up

Keep delete/version evidence through the longest supported delayed fetch or replay. If history is missing, rebuild rather than guess.

Deep dive 3

What happens if a region fails?

Reject old updates even when they arrive late from another region.

Read the explanation and worked example
How it works

Carry source versions and delete barriers through regional invalidation paths. The region receiving an update later must still reject older replacement values; transport arrival time cannot define global data order.

Walk through an example

A cross-region retry delivers update 11 after a region has already accepted update 12.

Failure and recovery

Ignore regressing updates, reconcile missing ranges from the source and rebuild a replica if its history falls outside the retained version/deletion window.

Why this helps

The same late-fill race exists across regions with a larger delay window.

What you give up

Asynchronous propagation permits bounded staleness; forcing synchronous global invalidation increases latency and can reduce write availability.

Deep dive 4

Delete propagation and version retention

A deleted key needs a durable version barrier through the stale-replay window.

Read the explanation and worked example
How it works

Represent a delete with its own source-assigned version. Cache consumers preserve the minimum acceptable version even when the cached value is absent. Align with maximum worker delay, replay history and the longest supported replica outage.

Walk through an example

Delete version 12 arrives, the value is removed, and a delayed version-11 refill returns later. Absence alone does not tell the cache to reject that stale refill.

Failure and recovery

Reject the older fill; retain the deletion/version floor or rebuild from current source state before accepting updates after lost history.

Why this helps

Deletes are state transitions, not simply opportunities to free cache memory.

What you give up

Longer barrier consumes memory; shortening it requires stronger bounds on stale work and a rebuild policy.

Tradeoffs and alternatives

DecisionTradeoff / alternative and recovery implication
Let source versions decide which update winsKeeping version barriers uses memory. Rechecking the source gives stronger freshness but increases read cost and dependency on the source.
Repair missed or reordered updatesKeep delete/version evidence through the longest supported delayed fetch or replay. If history is missing, rebuild rather than guess.
What happens if a region fails?Asynchronous propagation permits bounded staleness; forcing synchronous global invalidation increases latency and can reduce write availability.
Delete propagation and version Longer barrier consumes memory; shortening it requires stronger bounds on stale work and a rebuild policy.

Production scars & failure modes

Failure investigation

Version 12 arrives before version 11 at one cache replica.

Look for: Record the highest applied version and invalidation backlog.

Recovery and invariant: Reject regressing updates, preserve versioned deletes and repair from authoritative state; message arrival order is not the data version.

Component / failureImpactRecovery mechanismAlternative / tradeoff
Primary failure / raceA read of version 7 starts before a write of version 8. The invalidation reaches the cache before the slow read fills it. What happens?Reject the late version-7 fill against the version-8 floor. Deliver updates through durable / and reconcile missed events.Version floors cost memory; alone does not close the race and stronger freshness may require checking the source.
Recovery follow-upLet the expire while a very slow version-7 fetch is still running. State the supported request/replay horizon.Reject the late version-7 fill against the version-8 floor. Deliver updates through durable / and reconcile missed events.State the guarantee you relax and how you detect recovery.

90-second interview summary

For write propagation, I would make the source-assigned version the authority and treat invalidation delivery as delayed, duplicated and potentially reordered. Each source transaction commits the new value/version and durable publication intent together.

A cache maintains a minimum acceptable version. Installing a refill or replacement compares that version and writes the value atomically at the cache owner. This prevents a slow version-7 read from reinstalling old data after version-8 invalidation has already arrived.

Deletes need the same protection: removing the cached value is not enough if an older refill can return later. A versioned deletion barrier remains through the supported stale-work and replay window. Event notifications speed convergence, while periodic repairs missed delivery.

I would test reordered updates, consumer restart, cache loss and a region delayed beyond retained history. Recovery either rebuilds the current source version/barrier or rejects unsupported stale input. Metrics include propagation age, regressing-update rejection and repair gaps. The tradeoff is extra per-key version/deletion state and more complex cache writes in exchange for bounded stale behavior; simply relying on event arrival time or a short leaves the late-fill race unresolved.

Explain it without looking

Explain let source versions decide which update wins

Reveal answer

The source assigns versions and each cache rejects older replacements.

Network arrival order can differ from the order in which the source committed changes.

Keeping version barriers uses memory. Rechecking the source gives stronger freshness but increases read cost and dependency on the source.

Explain repair missed or reordered updates

Reveal answer

Reject old fills and replay durable changes from the source.

A crash can happen between any two delivery steps; one missed notification cannot be the only record of a required update.

Keep delete/version evidence through the longest supported delayed fetch or replay. If history is missing, rebuild rather than guess.

Explain what happens if a region fails?

Reveal answer

Reject old updates even when they arrive late from another region.

The same late-fill race exists across regions with a larger delay window.

Asynchronous propagation permits bounded staleness; forcing synchronous global invalidation increases latency and can reduce write availability.

Explain delete propagation and version

Reveal answer

A deleted key needs a durable version barrier through the stale-replay window.

Deletes are state transitions, not simply opportunities to free cache memory.

Longer barrier consumes memory; shortening it requires stronger bounds on stale work and a rebuild policy.

Revision checklist

Revision checklist

  • Reconstruct let source versions decide which update wins: The source assigns versions and each cache rejects older replacements.
  • Reconstruct repair missed or reordered updates: Reject old fills and replay durable changes from the source.
  • Reconstruct what happens if a region fails?: Reject old updates even when they arrive late from another region.
  • Reconstruct delete propagation and version : A deleted key needs a durable version barrier through the stale-replay window.
  • 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