Markdown Editor

Distributed Cache System Design Template

Distributed cache: cache-aside, delete on write, leases against herds, commit-log invalidation across regions, slot maps, hot keys, gutter pool, warm-up

Diseño de sistemasCompletadesigndistributedcachemath

Cómo usar: Use it when designing a shared cache tier in front of databases for read-heavy traffic. Fill the database's tolerable miss rate and the hit-ratio target first, because they drive leases, failure handling and warm-up. The main pitfall is setting values on write and rehashing on node failure, which create stale data and cascading misses.

Vista previa

System Design: [Distributed cache name]

Reference design for a shared, in-memory distributed cache tier that sits in front of databases and services in read-heavy workloads. It covers the cache-aside (look-aside) pattern, leases against stale sets and thundering herds, invalidation across clusters and regions, consistent hashing and slot maps, hot keys, warm-up of cold clusters, and failure handling with a small standby ("gutter") pool. Concepts draw on "Scaling Memcache at Facebook" (Nishtala et al., NSDI 2013); the text and the worked design are original. It follows the structure of the System Design Document template. Replace every [bracketed] value and every row marked Example.

Document control

FieldValue
Document ID[SDD-CACHE-001]
System / feature[Shared cache tier for profile and content reads]
Version[0.1]
Status[Draft / In review / Approved / Implemented / Superseded]
Owner[@owner]
Author(s)[@author]
Reviewers[@reviewer-1], [@reviewer-2]
Last updatedYYYY-MM-DD
Classification[Internal]
Consistency target[Example: Eventual, stale reads bounded to seconds; read-your-writes for the writer]
RelatedDistributed Key-Value Store System Design (system-design/design-distributed-kv-store), CDC Pipeline System Design (system-design/design-cdc-pipeline), Resilience and Load Shedding Design (system-design/resilience-load-shedding-design)

Approvals

RoleNameDecisionDate
Tech lead[@name][Approved / Changes requested]YYYY-MM-DD
Staff / principal engineer[@name][Decision]YYYY-MM-DD
SRE / operations[@name][Decision]YYYY-MM-DD
Database owner[@name][Decision]YYYY-MM-DD
Security[@name][Decision]YYYY-MM-DD

Revision history

VersionDateAuthorChange summary
0.1YYYY-MM-DD[@name]First draft for design review
0.2YYYY-MM-DD[@name]Example: Switched from set-on-write to delete-on-write after stale-data incident
0.3YYYY-MM-DD[@name]Example: Added gutter pool instead of rehashing on node failure
1.0YYYY-MM-DD[@name]Example: Approved

Contents

1. Overview

1.1 Problem statement

[Example: Each service runs its own cache cluster with its own conventions. Writers update cache values after writing the database, and races leave stale profiles for hours. When a popular item expires, thousands of requests miss at once and the database falls over. A single cache node failure moved a third of the keys to other nodes and caused a cascade of misses.]

1.2 Proposed solution

[Example: A shared cache tier of stateless-looking, memory-only cache servers, organised in clusters per region. Clients use cache-aside: read the cache, on a miss read the database and fill the cache with a lease token so that stale fills are rejected and only one client per hot key refills it at a time. Writers never set values; they delete keys, and deletes are also generated from the database commit log and fanned out to every cluster and region. Keys map to servers through a versioned slot map. A small gutter pool absorbs traffic for failed servers so their keys do not move. New clusters warm up by reading through a warm cluster.]

1.3 Decisions requested from reviewers

IDQuestionRecommended optionSection
Q-01Example: Cache pattern?Cache-aside with delete on write7.1
Q-02Example: How to stop thundering herds and stale fills?Leases issued by the cache server7.2
Q-03Example: Who sends invalidations?Commit-log-driven delete stream, plus TTL as a safety net7.3
Q-04Example: What happens when a node dies?Gutter pool, no rehashing7.4
Q-05Example: Replicated or partitioned clusters per region?Partitioned within a cluster; several clusters per region for read scale6, 8
[Q-nn][Question][Option][Section]

1.4 45-minute interview path

MinutesCoverOutput on the whiteboard
0 to 5Read/write ratio, staleness tolerance, what the database can absorbCore requirements, hit-ratio target
5 to 10Throughput, memory, hot keys, fan-out64 nodes, throughput-bound; hot key needs replication
10 to 18Cache-aside flow and topology diagramSection 6 diagram
18 to 33Deep dive: leases (7.2) and invalidation across regions (7.3); if the interviewer pushes on availability, use failure handling and warm-up (7.4)Lease sequence, delete stream
33 to 40Hot keys and multi-get fan-outL1 cache, replication, batching
40 to 45Trade-offs and 10xTable in section 10

2. Requirements

2.1 Core functional requirements

IDRequirementPriority
FR-01Example: Get and multi-get of up to 500 keys per callMust
FR-02Example: Fill on miss with protection against stale fills and herdsMust
FR-03Example: Delete keys from any writer and from the database commit logMust
FR-04Example: Propagate deletes to every cluster in every regionMust
FR-05Example: Writers read their own writes on the next requestMust
FR-06Example: Per-namespace TTL and memory quotaShould
FR-07Example: Bulk invalidation of a namespace by bumping its versionShould
[FR-nn][Requirement][Must / Should / Could]

2.2 Non-functional requirements

IDQualityTargetMeasured as
NFR-01LatencyExample: p99 below 1 ms for get, below 5 ms for a 100-key multi-getClient-side histograms
NFR-02Hit ratioExample: at least 98% for the profile namespaceServer counters
NFR-03StalenessExample: 99.9% of deletes applied in all regions within 5 sProbe writes
NFR-04Database protectionExample: Database read QPS never above 300 000, even during cache failuresDatabase metrics
NFR-05AvailabilityExample: Loss of one cache node raises database load by under 2%Chaos test
[NFR-nn][Quality][Target][Measurement]

2.3 Below the line (out of scope)

  • [Example: Durable storage; the cache may lose any data at any time (see system-design/design-distributed-kv-store for durable key-value storage)]
  • [Example: Transactions or compare-and-set across keys]
  • [Example: Caching personalised HTML at the edge (handled by the CDN)]
  • [Example: Strong consistency for money or inventory; those reads go to the database]
  • [Item deferred, with the release that will take it]

3. Capacity estimation

3.1 Assumptions

InputSymbolValueSource
Peak cache reads per second (keys)RRExample: 10 millionClient metrics x growth
Peak writes per second (database)WWExample: 200 000Database metrics
Keys invalidated per writekkExample: 2Key derivation rules
Cached items in the working setNNExample: 2 billionKey sampling
Average item size incl. overheadssExample: 500 BServer stats
Usable memory per nodemmExample: 64 GBInstance type
Operations per second per nodeccExample: 200 000Benchmark
Keys per page request (multi-get)qqExample: 100Trace sampling

3.2 Hit ratio and database load

D=R×(1−h)D = R \times (1 - h)

At h=0.98h = 0.98, D=107×0.02=200 000D = 10^{7} \times 0.02 = 200\,000 database reads/s; at h=0.90h = 0.90, D=1 000 000D = 1\,000\,000/s. Consequence: a drop of 8 points in hit ratio multiplies database reads by five and breaks NFR-04, so the design spends most of its complexity keeping the hit ratio stable when keys expire (leases), when nodes fail (gutter) and when clusters are new (warm-up).

3.3 Nodes

Nmem=N×sm=2×109×500 B64 GB≈15.6⇒16N_{mem} = \frac{N \times s}{m} = \frac{2 \times 10^{9} \times 500\ \text{B}}{64\ \text{GB}} \approx 15.6 \Rightarrow 16
Nops=R+W×kc×1.25=107+4×1052×105×1.25=65⇒66N_{ops} = \frac{R + W \times k}{c} \times 1.25 = \frac{10^{7} + 4 \times 10^{5}}{2 \times 10^{5}} \times 1.25 = 65 \Rightarrow 66

Consequence: the tier is throughput-bound, not memory-bound, so choose instances with more CPU and network per GB, and use the spare memory (66 nodes x 64 GB, about 4.2 TB against a 1 TB working set) to cache a longer tail and raise the hit ratio.

3.4 Network and fan-out

Total read bandwidth is 107×50010^{7} \times 500 B =5= 5 GB/s, about 76 MB/s per node, which is modest. Fan-out is the real cost: with 100 keys spread over 66 nodes, the expected number of distinct nodes touched is

66×(1−(6566)100)≈66×(1−0.217)≈5266 \times \left(1 - \left(\frac{65}{66}\right)^{100}\right) \approx 66 \times (1 - 0.217) \approx 52

Consequence: a page waits for the slowest of about 52 parallel requests, so tail latency of single nodes dominates (incast). Batch per node, cap outstanding requests per client, and group keys that are read together (same hash tag) where the data model allows it.

3.5 Hot keys

A viral item read 1 million times per second exceeds one node's 200 000 ops/s by five times. Consequence: hot keys need replication (several copies under suffixed keys) or a client-side L1 cache with a 1 s TTL; with 2 000 web servers each refreshing once per second, the cache tier sees about 2 000 reads/s for that key instead of 1 million.

3.6 Summary

QuantityEstimateDesign consequence
Database reads at 98% hit200 000/s (1 million/s at 90%)Leases, gutter and warm-up protect hit ratio
Nodes66, throughput-boundCPU-heavy instances; spare memory raises hit ratio
Multi-get fan-out~52 nodes per pagePer-node batching, flow control, key co-location
Hot key5x one node's capacityL1 cache and hot-key replication
Deletes400 000/sBatched delete stream through routers

4. API design

4.1 Client operations

OperationReturnsNotes
get(key)value or miss
multi_get(keys)map of found valuesBatched per node, parallel across nodes
lease_get(key)value, or miss with lease token, or wait hint, or stale value plus stale flagSee 7.2
lease_set(key, value, token, ttl)stored or rejectedRejected if token was invalidated by a delete
delete(key, hold_off_ms = 0)deleted or not_foundOptional hold-off rejects fills for a short period
touch(key, ttl)okExtend TTL
bump_namespace(ns)new versionLogical bulk invalidation

4.2 Read path in code

def read_profile(user_id):
    key = f"profile:v3:{user_id}"
    r = cache.lease_get(key)
    if r.hit:
        return r.value
    if r.wait:                      # another client holds the lease
        sleep_ms(r.retry_after_ms)  # short backoff, then one retry
        r2 = cache.get(key)
        if r2.hit:
            return r2.value
    value = db.read_profile(user_id)          # one database read
    if r.token:
        cache.lease_set(key, value, r.token, ttl=3600)
    return value

Write path: commit the database transaction, then delete(key). The commit log consumer (7.3) deletes the same key again everywhere; deletes are idempotent, so the duplicate is harmless.

4.3 Admin API

Method and pathPurpose
GET /v1/slotmapCurrent slot-to-node map and version
PUT /v1/slotmapPublish a new version (rebalance, replace node)
PUT /v1/namespaces/{ns}TTL, memory quota, hot-key replication factor
POST /v1/clusters/{id}:warmupStart or stop warm-up from a named warm cluster

5. Data model

5.1 Keys and values

Keys follow {namespace}:{schema_version}:{entity_id}[:{variant}], for example profile:v3:918273 or feed:v2:918273:page1. The schema version in the key lets a deploy that changes the value format read new keys while old ones expire. Values carry a small header:

FieldPurpose
fmtSerialisation format and version
written_atDiagnostics; age histograms
src_versionDatabase row version or commit position, for debugging staleness
payloadSerialised object, compressed above Example 1 KB

Server-side lease state is kept in memory per key: token, issued time, and whether a delete has invalidated it.

5.2 Storage choices

DataStoreKeyWhy
Cached objectsIn-memory cache servers with LRU per slab classCache keySub-millisecond reads
Hot-key copiesSame servers, keys suffixed #r0 to #r7Cache key + replica suffixSpread one key over several nodes; a delete must reach every suffix
Slot mapCoordination service (system-design/design-distributed-lock-coordination), cached in routers and clientsVersion numberConsistent routing across all clients
Remote markersRegional poolrm:{key}Read-after-write in replica regions (7.3)

5.3 Access patterns

Access patternServed byPartition key and rationale
Read one profileprofile:v3:{user_id} on slot hash(user_id)Entity ID gives uniform spread
Read a page of 100 objectsMulti-get, batched per nodeKeys co-located by hash tag only when always read together; otherwise spread for balance
Read a viral itemL1 client cache, then one of 8 replicas item:{id}#r{n}Random replica per client spreads load
Invalidate after a writeDelete by key from commit log consumerSame key derivation in writer and consumer library
Invalidate a whole namespaceBump ns version stored in the coordination serviceOld keys age out by TTL and LRU
Check read-after-write in replica regionrm:{key} in the regional poolOne small marker per recently written key

6. High-level design

ComponentResponsibilityScales by
Client library + L1Key derivation, leases, multi-get batching, tiny hot-key cacheWith clients
Cache routersRoute by slot map, batch, fail over to gutter, fan out deletesStateless replicas
Cache clustersStore items; several clusters per region each hold the full key spaceNodes per cluster, clusters per region
Regional poolOne copy per region for large, rarely read items and remote markersNodes
Gutter poolShort-TTL stand-in for failed nodes (about 1% of servers)Nodes
Commit log consumerTurn committed row changes into key deletes (system-design/design-cdc-pipeline)Log partitions

7. Detailed design

7.1 Deep dive: caching pattern and write handling

OptionHow it worksStrengthWeakness
A. Cache-aside, set on writeWriter updates database, then sets the new valueFresh immediatelyTwo concurrent writers can set out of order; stale value stays until TTL
B. Cache-aside, delete on writeWriter updates database, then deletes; next reader fillsDeletes are idempotent and commuteOne extra miss after each write
C. Read-throughCache fetches from the database itselfSimple clientsCache must know every data source
D. Write-throughWrites go through the cache to the databaseCache always populatedWrite latency; cache on the write critical path
E. Write-behindCache acknowledges, persists laterFast writesData loss on cache failure; wrong for a memory-only tier

Choice: B. Reason: deletes are safe under any interleaving and any duplication, which matters because deletes arrive from writers and again from the commit log; the remaining race (a reader fills a value it read before the write) is closed by leases in 7.2.

7.2 Deep dive: leases against stale sets and thundering herds

Two problems happen on a miss:

  • Stale set: reader A misses and reads version 1 from the database; writer B commits version 2 and deletes the key; A then sets version 1, which stays until TTL.
  • Thundering herd: a hot key is deleted or expires; thousands of readers miss at once and all query the database.
OptionFixes stale setFixes herdCost
A. Short TTLs onlyBounds stalenessNoMore misses
B. Version check on set (compare with database version)YesNoVersion per value; extra logic in writers
C. Client-side request coalescingNoPer client onlyHerd across clients remains
D. Server-issued leasesYesYesServer state per missing key; client retry logic
E. Probabilistic early refreshNoMostlyBackground refresh load

Choice: D. Reason: one mechanism fixes both problems at the server that sees every request for the key.

  1. On a miss, the server returns a lease token bound to the key.
  2. A delete of that key invalidates outstanding tokens, so a fill based on an older read is rejected.
  3. The server issues at most one token per key per interval (Example 2 s); other clients get a short wait hint and retry, by which time the lease holder has usually filled the value.
  4. For data classes that tolerate it, the server keeps a recently deleted value and returns it marked stale instead of wait, so readers never block.

Set the lease interval and wait hint from measured database read latency for the namespace; a hint shorter than the database read creates repeated retries.

7.3 Deep dive: invalidation across clusters and regions

Several clusters per region each hold the full key space, and replica regions read from replica databases. A delete must reach every copy.

OptionHow it worksStrengthWeakness
A. TTL onlyValues expireNo infrastructureStaleness equals TTL
B. Writer broadcasts deletesApplication deletes in every cluster and regionImmediateWriter crash loses deletes; writers need every endpoint
C. Commit-log-driven deletesA consumer of the database commit log derives keys and deletes them through routers in each regionReliable (replayable), no writer couplingKey derivation must be shared code; small delay
D. Versioned keysKey includes data version; readers look up version firstNo deletes neededExtra lookup per read

Choice: C plus the writer's own local delete and a TTL safety net. Reason: the commit log is the only place every committed change appears exactly once in order, so invalidations become as reliable as replication; the writer's local delete gives read-your-writes in its own cluster.

In replica regions the replica database may lag; a reader that misses could fill the cache from a replica that has not yet seen the write. Two measures:

  • Deletes in replica regions are produced from the replica's commit log, so they arrive after the replica has applied the change.
  • For read-your-writes, the writer sets a short-lived remote marker for the key in the regional pool before writing; a reader in that region that misses and finds the marker reads from the primary region's database instead of the local replica. The marker is removed when the change replicates or by TTL.

7.4 Deep dive: partitioning, failure handling and warm-up

Key distribution options:

OptionHow it worksRebalance costNotes
A. hash mod NNode = hash(key) mod NAlmost every key moves on changeUnusable at scale
B. Consistent hashing ring with virtual nodesEach node owns many ring pointsAbout 1/N of keys moveEven load needs many virtual nodes
C. Rendezvous hashingHighest score of hash(key, node) winsAbout 1/N of keys moveO(N) per lookup without tricks
D. Slot maphash(key) mod 16 384 slots; slots assigned to nodes in a versioned mapMove chosen slots explicitlyMap must be distributed consistently

Choice: D. Reason: explicit slot moves make rebalancing a planned, observable operation, hot slots can be moved alone, and the map version lets routers detect stale routing.

Failure options:

OptionWhat happens on node lossRisk
A. Rehash keys to remaining nodesLost node's keys spread to othersMoved keys miss; a hot key can overload its new node, causing cascading failures
B. Replicate every keyReplica servesDoubles memory and delete fan-out
C. Gutter poolRouters send that node's traffic to a small dedicated pool; entries there have a short TTL and are not invalidatedShort staleness for affected keys

Choice: C. Reason: failures stay contained to a pool sized for them, other nodes keep their keys and hit ratios, and the database sees only the first miss per key. A permanent replacement is done by a planned slot-map change.

Cold cluster warm-up: a new or emptied cluster reads misses from a warm cluster in the same region and adds the value locally, instead of going to the database. Deletes to the cold cluster use a short hold-off (Example 2 s) during which adds are refused, so a value that the warm cluster has not yet invalidated cannot be copied in; a refused add sends the reader to the database. Turn warm-up off when the cold cluster's hit ratio stabilises.

7.5 How real systems do it

How real systems do it (paraphrased, not copied). Nishtala and colleagues describe Facebook's memcache deployment in "Scaling Memcache at Facebook" (NSDI 2013). The cache is a demand-filled look-aside cache and writers delete rather than update. Memcached hands out leases on misses: a delete invalidates the token so late fills are refused, and tokens for a key are issued only every few seconds so most concurrent readers wait briefly instead of hitting the database. A small Gutter pool, around one percent of cache servers, takes over for failed servers with quickly expiring entries, avoiding the rehashing that can cascade. Invalidations come from daemons that tail the database commit log and are batched through routers. Rarely accessed items can share one regional pool, new clusters warm up from existing ones using deletes with a hold-off, and replica regions use remote markers to send reads of just-written keys to the master region. This template reuses the ideas, not the text or figures.

8. Scalability and performance

ConcernApproachLimit before redesign
Read throughputAdd nodes to a cluster or add clusters per regionDelete fan-out grows with clusters
MemoryLarger instances or more nodes; regional pool for cold large itemsWorking set beyond cluster memory lowers hit ratio
Hot keysL1 cache, replica keys, automatic hot-key detection by samplingOne key above L1 refresh x clients
Fan-outBatch per node; co-locate keys read togetherPages with thousands of keys need a precomputed aggregate
ConnectionsRouters multiplex client connectionsRouter count
Invalidation rateBatched deletes per nodeExample: 400 000 deletes/s x clusters x regions

Latency budget for one get (NFR-01, Example): client library 0.05 ms, router hop 0.2 ms, server 0.05 ms, network 0.3 ms, headroom 0.4 ms. Remove the router hop for the hottest services by running the router as an in-process library.

9. Reliability, security and operations

9.1 Failure-mode table

ComponentFailureDetectionBlast radiusMitigationRTO
Cache nodeCrashRouter health checksThat node's slots, about 1/66 of keysGutter pool, then slot-map replacementExample: seconds to gutter; 30 min to replace
Whole clusterLost or flushedHit ratio collapseOne cluster's clientsShift clients to other clusters; warm-up from warm clusterExample: 15 min
Commit log consumerStalledDelete lag metricStaleness everywhere up to TTLRestart from committed position; deletes replayExample: 5 min
Hot keySingle key overloads nodePer-key sampling, node CPUEvery key on that nodePromote to replicated key; L1Example: 1 min automated
Slot mapBad version publishedRouting error rateAll clientsVersioned rollback; staged publishExample: 2 min
DatabaseOverloaded by missesDatabase QPS and latencyAll servicesLeases, load shedding (system-design/resilience-load-shedding-design), serve staleDepends on cause
[Component][Failure][Signal][Scope][Mitigation][Time]

9.2 Security

ThreatControl
Unauthenticated access to cache serversPrivate network only; TLS and client authentication between routers and servers
Cross-tenant readsNamespaces per service; router enforces which namespaces a client may use
Sensitive data in memoryDo not cache secrets or full payment data; encrypt sensitive values with a service key
Cache poisoning via user-controlled keysKeys derived by the library from typed IDs, never from raw input
[Threat][Control]

9.3 Observability

SignalMetricAlert threshold
Hit ratioPer namespace and clusterExample: below 96% for 10 min
Database protectionDatabase read QPSAbove 250 000/s
Latencyp99 get and multi-get per clientAbove NFR-01 for 10 min
InvalidationDelete lag from commit to apply, per regionAbove 5 s at p99
LeasesWait hints and rejected sets per secondDoubling vs. baseline
EvictionsEvictions of items younger than 1 hRising trend means memory is short

10. Trade-offs and alternatives

DecisionOptionsChosenWhyWhat we give up
Write handlingSet; deleteDelete on writeSafe under reordering and duplicatesOne miss after each write
Herd and stale fillsTTL; version checks; leasesLeasesFixes both at the serverRetry logic in clients
Invalidation sourceWriters; commit log; TTLCommit log + local delete + TTLReliable and replayableShared key-derivation code
DistributionRing; rendezvous; slot mapSlot mapExplicit, observable movesMap distribution
Node failureRehash; replicate; gutterGutterContained blast radiusBrief staleness on gutter
ProductSelf-built; open-source cache servers; managed service[Choice][Reason][Cost]
At 10x load100 million reads/sMore clusters per region and larger fan-out batches; precomputed aggregates for pages with many keys; L1 for more namespacesFan-out and delete fan-out grow faster than readsMore clusters to invalidate
At 0.1x load1 million reads/sOne cluster of about 7 nodes per region; leases and commit-log deletes still worth it; gutter can be one nodeSimpler topologyLess isolation between services

11. Delivery plan and risks

11.1 Milestones

MilestoneScopeExit criterionTarget date
M1Client library with leases, one cluster, profile namespaceHit ratio at least 98%; no stale profiles in sampled checksYYYY-MM-DD
M2Commit-log deletes in primary region; writers switch to deleteDelete lag p99 under 1 sYYYY-MM-DD
M3Gutter pool and slot-map rebalancingNode-kill drill meets NFR-05YYYY-MM-DD
M4Replica regions, remote markers, warm-upCold cluster reaches 95% hit ratio without database spikeYYYY-MM-DD

11.2 Rollout and rollback

[Example: Migrate one namespace at a time behind a flag that chooses the old or new client library. Rollback flips the flag; both tiers receive deletes during migration so neither serves stale data after a switch.]

11.3 Risks

IDRiskLikelihoodImpactMitigationOwner
R-01Example: Key derivation differs between writer and commit-log consumerMediumHighOne shared library; contract tests[@name]
R-02Example: Teams cache data that needs strong consistencyMediumHighReview per namespace; documented data classes[@name]
R-03Example: Gutter pool undersized for a rack failureLowHighSize for the largest failure domain; drill[@name]
R-04Example: Lease wait hints add latency to hot pagesMediumMediumStale-value mode for tolerant namespaces[@name]
[R-nn][Risk][L / M / H][L / M / H][Mitigation][@name]

12. Appendices

12.1 Open questions

IDQuestionOwnerDue
OQ-01Example: Which namespaces may receive stale values on lease wait?[@name]YYYY-MM-DD
OQ-02Example: Is a second gutter pool per rack needed?[@name]YYYY-MM-DD
[OQ-nn][Question][@name]YYYY-MM-DD

12.2 Glossary

TermMeaning
Cache-aside (look-aside)The application reads the cache and fills it from the source on a miss
LeaseA token a cache server gives on a miss; required to fill the key and invalidated by deletes
Thundering herdMany clients missing the same key at once and overloading the source
Gutter poolSmall set of servers that stands in for failed servers with short-lived entries
Slot mapVersioned assignment of hash slots to cache nodes
Remote markerShort-lived flag that a key was just written, used to route reads to the primary region
Hold-offPeriod after a delete during which adds for that key are refused
[Term][Meaning]

12.3 Related templates

  • Distributed Key-Value Store System Design (system-design/design-distributed-kv-store): durable storage, when a cache is not enough.
  • CDC Pipeline System Design (system-design/design-cdc-pipeline): commit-log stream that drives deletes.
  • Distributed Lock and Coordination Service System Design (system-design/design-distributed-lock-coordination): slot map and configuration storage.
  • Resilience and Load Shedding Design (system-design/resilience-load-shedding-design): protecting the database when the cache fails.
  • Back-of-Envelope Estimation (system-design/back-of-envelope-estimation): method behind section 3.

12.4 References

ReferenceUse
Nishtala R. et al., "Scaling Memcache at Facebook", 10th USENIX Symposium on Networked Systems Design and Implementation (NSDI '13), 2013Leases, gutter pool, commit-log invalidation, regional pools, cold cluster warm-up, remote markers (7.2 to 7.5)
Kleppmann M., Riccomini C., Designing Data-Intensive Applications, 2nd ed., 2026 (inspiration only)Background on derived data and caching

Standard and licence note

Based on the publicly described techniques in the NSDI 2013 memcache paper cited in 12.4 and on common industry practice; no standard governs cache tiers. This is a reference design to adapt, with illustrative numbers marked Example. Original text written for this collection; sources were used as inspiration only and no text, figures or diagrams were copied. Check the current documentation of the cache software you adopt. Template licence: MIT.

Plantillas relacionadas