System design paper · 2007

Dynamo

DeCandia, Hastorun, Jampani, Kakulapati, Lakshman, Pilchin, Sivasubramanian, Vosshall and Vogels · SOSP 2007

How Amazon built a key-value store that accepts every write, even while servers fail and the network splits.

Each key is stored on the first N nodes clockwise from its position on the ring. Here N = 3.

You’ll learn to

  • Explain how consistent hashing and virtual nodes spread keys across a ring of servers.
  • Pick N, R and W for a quorum and predict what each choice costs.
  • Describe how vector clocks detect conflicting writes, and who resolves them.
  • Name the parts of Dynamo that later systems kept, and the parts they dropped.

Read first: Consistent hashing

The idea in short

Amazon’s shopping cart must accept an “add to cart” even when servers are down. Dynamo chooses availability over consistency: every write succeeds somewhere, and the system sorts out disagreements later, when the data is read.

It combines a handful of known techniques into one design: consistent hashing to place data, quorums to tune reads and writes, hinted handoff to ride out failures, vector clocks to spot conflicts, Merkle trees to repair replicas and gossip to track which servers are alive.

The problem

Amazon runs on hundreds of services spread over tens of thousands of servers in data centres around the world. Building one product page can mean calls to over 150 of them. At that size, something is always broken: a disk, a server, a network link. The shopping cart still has to take every “add to cart”.

The paper sets the bar plainly: customers must be able to add items to their cart even if disks are failing, network routes are flapping, or “data centers are being destroyed by tornados”. A rejected write is a customer who can’t buy something.

The databases of the day didn’t fit. Relational databases that replicate data usually choose consistency over availability: when replicas can’t agree, they refuse the write. They also bring features most of these services never used. Best seller lists, shopping carts, customer preferences, session data, sales rank and the product catalogue all read and write one item at a time, by its key. No joins, no queries across many rows, and objects usually under 1 MB.

Speed mattered as much as staying up. Amazon’s services promise each other response times, and they measure those promises at the 99.9th percentile, not the average. A typical promise for Dynamo: 99.9% of reads and writes finish within 300 ms. Averages hide who the slow requests hit. The paper’s example: with heavy personalisation, customers with longer histories need more processing, so they land in the slow tail.

So the team asked a narrow question: what does a store look like if it only does key lookups, runs on hundreds of ordinary servers, treats failure as normal and never refuses a write?

Some things were left out on purpose. Dynamo runs inside Amazon’s own network, so it has no authentication or authorisation. Each service runs its own Dynamo cluster, sized for that service, rather than sharing one giant store.

The design choices

Every replicated store has to decide when replicas sort out their disagreements. Most do it on write: if the replicas can’t confirm the write, it fails. Dynamo does it on read. Writes always land somewhere, and when a read finds two versions that disagree, that’s when the conflict gets resolved.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan

About the paper

Dynamo: Amazon’s Highly Available Key-value Store by DeCandia, Hastorun, Jampani, Kakulapati, Lakshman, Pilchin, Sivasubramanian, Vosshall and Vogels, SOSP 2007.

Read the original paper

More System design papers

All papers