code.davidloor.com

Open prompt · 45 min recommended

Design a Distributed Cache

00:00

Target 45:00

Design a Distributed Cache

You have 45 minutes. Sketch the system in this notes pane.

Scope

Functional requirements

Non-functional requirements

Out of scope

Suggested approach

  1. Clarify requirements — expected total data size, number of client nodes, hotspot tolerance, durability requirements (can the cache be a warm-up layer or must it tolerate cold starts?)
  2. High-level design — a cluster of cache nodes; a consistent-hashing ring to distribute keys; a thin client library used by all application servers
  3. API + data model — simple KV interface: get, set, delete; values are opaque byte arrays; keys are strings
  4. Storage + caching — each node stores an in-memory hash map; entries are evicted by LRU or LFU when memory is full; optionally replicate each key to one or two additional nodes for fault tolerance
  5. Bottlenecks + mitigations — hot keys hitting one node, node failures causing a miss spike, thundering herd on cold start

Reference talking points

Your notes

Saved locally · 0 chars