AlgoViz

Dynamo: Amazon's highly available key-value store

medium 35 min

Amazon's shopping cart had to accept every add, even while servers and links failed.

Remember it

The few things worth knowing cold, and how to make them stick.

Memory hook

Never say no to a write. Keep every version you cannot order, and merge when you read.

Five cottages round a pond keep the street party list. Each line lives in the first cottage clockwise and the next two. Two copies are enough to say done, a neighbour keeps a page with a note for someone away, tallies under names tell newer from side by side, and pages are merged when the path opens again.

Cheat sheet

Paper
DeCandia et al., SOSP 2007
Common N, R, W
3, 2, 2
Put done after
W copies, coordinator included
Overlap
R + W > N, same N only
Short failure
sloppy quorum + hint
Long drift
Merkle anti-entropy
Membership
gossip every 1 s, seeds
Clock limit
"say 10" pairs
One version
99.94% of cart reads
SLA example
300 ms at 99.9%, 500 req/s

Spot it when you see

  • "Must accept writes during outages."
  • "Shopping cart" or "wish list".
  • "Tune latency against freshness."
  • "How do replicas catch up?"

Tricks that stick

  • Place, copy, count, stamp, cover, repair, chat.
  • Sloppy means any N healthy, not the N owners.
  • Union never loses an add, and never forgets an add either.
  • DynamoDB: same name, different design.

Do not forget

  • Calling R + W > N strong consistency.
  • Two copies on one machine.
  • Last write wins for a cart.
  • Union merge without remove markers.
  • Describing DynamoDB as Dynamo.
  • Using Dynamo-style storage for balances or bookings.