CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
πŸŒ™β˜€οΈ
Log inStart free
Home/Templates/System Design Interview Classics

πŸ“ System Design Interview Classics Β· Network

Distributed Cache with Consistent Hashing

How a distributed cache spreads keys across nodes with consistent hashing, so adding or removing a node moves only a small share of keys.

More System Design Interview Classics templates

Opening a template is free and never counts toward your daily diagrams. Asking the AI to change it counts as one.

Drawing diagram…

What this diagram shows

  • Keys map to positions on a hash ring
  • Each node owns several virtual positions for even load
  • Each key is copied to the next node for availability

Prompt used

Network view of a distributed cache: application servers use a client library that hashes each key onto a ring. Four cache nodes each own several virtual points on the ring. A key is stored on the first node clockwise and replicated to the next node. A configuration service tracks the ring and tells clients when nodes join or leave.

Mermaid code
flowchart LR
  A1[App Server 1] ---|"In-process calls"| LIB1[Cache Client Library]
  A2[App Server 2] ---|"In-process calls"| LIB2[Cache Client Library]
  subgraph RING[Hash Ring]
    N1[Cache Node A - vnodes 1,5,9]
    N2[Cache Node B - vnodes 2,6,10]
    N3[Cache Node C - vnodes 3,7,11]
    N4[Cache Node D - vnodes 4,8,12]
  end
  LIB1 ---|"GET/SET by key hash"| N1
  LIB1 ---|"GET/SET by key hash"| N2
  LIB2 ---|"GET/SET by key hash"| N3
  LIB2 ---|"GET/SET by key hash"| N4
  N1 -.replica.- N2
  N2 -.replica.- N3
  N3 -.replica.- N4
  N4 -.replica.- N1
  CFG[Config Service] ---|"Ring membership"| LIB1
  CFG ---|"Ring membership"| LIB2
  CFG ---|"Health checks"| RING

Inside this diagram

A network diagram with 11 components in 1 zone and 13 connections.

Zones and their devices

  • Hash Ring: Cache Node A - vnodes 1,5,9, Cache Node B - vnodes 2,6,10, Cache Node C - vnodes 3,7,11 and Cache Node D - vnodes 4,8,12

Outside the zones

  • App Server 1
  • Cache Client Library
  • App Server 2
  • replica
  • Config Service
  • RING

Connections

  • App Server 1 β€” Cache Client Library: In-process calls
  • App Server 2 β€” Cache Client Library: In-process calls
  • Cache Client Library β€” Cache Node A - vnodes 1,5,9: GET/SET by key hash
  • Cache Client Library β€” Cache Node B - vnodes 2,6,10: GET/SET by key hash
  • Cache Client Library β€” Cache Node C - vnodes 3,7,11: GET/SET by key hash
  • Cache Client Library β€” Cache Node D - vnodes 4,8,12: GET/SET by key hash
  • Cache Node A - vnodes 1,5,9 β€” replica
  • Cache Node B - vnodes 2,6,10 β€” replica
  • Cache Node C - vnodes 3,7,11 β€” replica
  • Cache Node D - vnodes 4,8,12 β€” replica
  • Config Service β€” Cache Client Library: Ring membership
  • Config Service β€” RING: Health checks

Make your own diagram like this

Describe your own system in plain English and CloudSketch AI draws it in seconds. See all AI diagram generators.

Related templates

C4 ArchitectureProSystem Design Interview Classics

URL Shortener System Design

The classic interview design for a service like bit.ly: short code generation, fast redirects from a cache, and click analytics processed separately.

SequenceSystem Design Interview Classics

Chat App Message Delivery (WhatsApp-style)

How a one-to-one chat message is delivered in a WhatsApp-style system, with sent, delivered and read ticks, and push notifications when the receiver is offline.

Data FlowSystem Design Interview Classics

Social News Feed (Twitter-style)

How posts reach followers' feeds: fan-out on write for normal users, fan-out on read for celebrities, and a ranked feed built from a cache.

C4 ArchitectureProSystem Design Interview Classics

Ride Matching System (Uber-style)

The core of a ride-hailing app: drivers stream their locations, a geo index finds nearby drivers, and a matching service offers the trip to the best one.

FlowchartSystem Design Interview Classics

API Rate Limiter (Token Bucket)

How a token bucket rate limiter decides whether to let an API request through, using Redis so all servers share the same counts.

DeploymentProSystem Design Interview Classics

Notification Service Design

A notification system that sends email, SMS and push messages at scale: one API, a queue per channel, user preferences, and retries.