Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 10 · From Scratch · Sharded KV store · with code: Go · about 17 min to read

Play it as a journeyTutor comes with a plan

Build Your Own Dynamo

Partitioning
Partitioning · Open board

One pile of data cut into slices, one slice per machine, and the ways of deciding which slice a name goes to. The warning in its bottom half, never pick the machine by dividing by the machine count, is the first wall this build hits.

Before you start. This series builds a small copy of Dynamo, the store Amazon wrote to keep each saved value on several machines and keep answering while some of those machines are dead. You need two ideas, refreshed here: a hash is a scrambler that turns any name into a big number, the same number every time for the same name, and a replica is one copy of a value kept on another machine, so the value survives when the first machine dies (if Go is new to you, Enough Go to read these builds is an optional read first).

Code: teaching/code/from-scratch/kv/: one Go module, each stage runs alone: go run ./01-ring … go run ./04-anti-entropy. Nothing listens on a network: the five machines are five entries in one program’s memory, so every run prints the same lines.

Lesson 70 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 20 March 2009: LinkedIn explains why it wrote its own store
  • Why not cut the database into pieces? A key-value store
  • Which office holds a name? The ring
  • How many offices must say yes? The quorum
  • An office is closed: hinted handoff
  • An office was away too long: anti-entropy
  • Kill two machines and measure: the whole store
  • The four stages
  • What you can run today
  • Go, as you go (new-to-Go markers)

Terms it explains: key-value store, ring, quorum, hinted handoff, anti-entropy, Project Voldemort, "Design", fixed-partition-count / dynamic partitioning, global (term-partitioned) index, gossip, hot spot / hot key, local (document-partitioned) index, MPP, partition / shard, range vs hash partitioning, rebalancing, request routing, secondary index, skew, ZooKeeper.

Related papers

Review From Scratch