Tags

Consistent Hashing

Consistent Hashing

0 lessons
6 system designs
1 community item

consistent-hashing

System Design

6 articles
System Design

Database Sharding & Partitioning Strategies

Sharding splits a database into many smaller pieces (shards) so writes and storage can scale across servers. The hard part is not the splitting; it is choosing a shard key that avoids hot shards, supporting cross-shard queries, and rebalancing as the data grows. This lesson covers the four sharding strategies, how to pick a shard key, the operational realities of resharding, and when sharding is the wrong answer.

data-partitioning
partitioning
database
horizontal-scaling
consistent-hashing
sql
system-design
intermediate

282

5

Medium
System Design

Distributed Caching (Redis, Memcached)

A single-node cache eventually runs out of RAM, CPU, or network. Distributed caching spreads keys across many nodes so total capacity and throughput scale horizontally. This lesson covers how Redis and Memcached partition data, replicate it for availability, fail over when nodes die, and how to choose between them. By the end you can design a multi-node cache layer for a real workload, defend the topology in an interview, and recognize the bug class behind 'why is one cache node maxed at 100% CPU while the others are idle?'.

caching
redis
memcached
consistent-hashing
distributed-systems
replication
failover
system-design
intermediate

806

6

Medium
System Design

Consistent Hashing & Data Distribution

Consistent hashing is the trick that lets distributed caches and databases add or remove nodes without remapping every key in the cluster. This lesson explains why naive `hash(key) % N` is broken, how the hash ring works, why you need virtual nodes to keep load balanced, and how real systems (DynamoDB, Cassandra, Memcached, Discord) implement it. We finish with the modern alternatives (rendezvous hashing, jump consistent hash, Maglev) and the trade-offs that make consistent hashing the answer in interviews 90% of the time.

consistent-hashing
data-partitioning
distributed-systems
distributed-cache
database-sharding
system-design
intermediate
free

696

17

Medium
System Design

Design a URL Shortener (TinyURL)

Design a URL shortening service like TinyURL or bit.ly that maps a long URL to a 7 character code, redirects clicks in under 50 ms, and survives a 100:1 read-to-write ratio. This lesson walks through capacity estimation, the choice between counter based and hash based key generation, the database split between a key store and an analytics store, and the caching strategy that lets a single mid-tier service handle 10K redirects per second on commodity hardware.

design-tinyurl
url-shortener
case-study
social-content-platforms
base62-encoding
read-heavy
consistent-hashing
caching
cdn
system-design
beginner
free

690

4

Easy
System Design

Design a Key-Value Store (DynamoDB)

Design a Dynamo-style distributed key-value store that scales linearly to thousands of nodes, stays available during partitions, and offers tunable consistency through a quorum (N, W, R). The interview centerpiece is the trio that makes this work at scale: consistent hashing with virtual nodes for partitioning, N/W/R quorums for replication and consistency, and vector clocks for resolving concurrent writes. We cover the gossip protocol for membership, Merkle trees for anti-entropy, hinted handoff for transient failures, sloppy quorum for write availability during partitions, and the LSM-tree storage engine that powers each node.

design-key-value-store
case-study
infrastructure-storage
dynamodb
key-value-store
consistent-hashing
vector-clocks
gossip-protocol
merkle-tree
lsm-tree
quorum
hinted-handoff
system-design
intermediate
premium

457

13

Medium
System Design

Design a Distributed Cache (Redis)

Design a Redis-style in-memory distributed cache that serves billions of GET/SET operations per day at sub-millisecond latency, with sharding across hundreds of nodes and explicit eviction when memory fills. The interview centerpiece is the eviction-and-partitioning combination: how LRU and LFU choose what to drop, and how a cluster picks which node owns each key without a central coordinator. We compare client-side hashing, proxy-based partitioning (twemproxy), and Redis Cluster's hash-slot model; we cover cache-aside as the dominant access pattern, replica failover, optional persistence, and the sub-ms latency budget that makes this design fundamentally different from the durable KV store covered in the previous case study.

design-distributed-cache
case-study
infrastructure-storage
redis
memcached
lru
eviction-policy
consistent-hashing
cache-aside
in-memory-store
system-design
intermediate
premium

1k

28

Medium