The Computing Series

Real Systems

Cassandra uses consistent hashing with virtual nodes. Each physical node is represented by 256 virtual nodes on the ring, which distributes load evenly even when physical nodes have different capacities. When a node joins, only the keys between its predecessor and itself migrate. Cassandra does not use a centralised routing coordinator — the client driver is given the ring state via gossip and routes requests directly to the correct replica.

Amazon DynamoDB uses a centralised routing layer backed by consistent hashing. Partition keys are hashed and mapped to partitions. DynamoDB automatically splits hot partitions — if a partition exceeds its provisioned throughput, the system detects the hotspot and subdivides the partition transparently. This automatic mitigation is not instant; brief hotspot spikes still cause throttling visible to clients as ProvisionedThroughputExceededException.

Google Spanner uses range partitioning via Paxos-based splits. The system monitors hot ranges and automatically splits them into smaller ranges that can be moved to less-loaded nodes. Because Spanner’s data model supports distributed transactions across partitions (via two-phase commit), range partitioning does not trade away transaction semantics. The cost is latency: cross-partition transactions require coordination across multiple Paxos groups.


Concept: Sharding and Partitioning

Thread: T8 (Distributed Systems) ← Book 2, Ch 15 (Consistent Hashing) → Book 5, Ch 8 (Distributed Database Design)

Core Idea: Partitioning divides a dataset across machines to scale beyond single-node capacity, with the partitioning strategy determining query expressiveness, load distribution, and rebalancing cost.

Tradeoff: AT5 — Centralisation/Distribution (central routing map vs. gossip-distributed ring state)

Failure Mode: FM6 — Hotspotting (sequential keys on range partitions saturate one shard while others sit idle)

Signal: When one shard’s CPU or I/O is consistently above 80% while other shards are below 20%, the partition key is creating a hot shard.

Maps to: Reference Book, Framework 3 (Threads) and Framework 5 (Infrastructure Components)


Read in the book →