Index

Module 08 · From ScratchSharded KV store

Watch: Sharding: splitting the ledger →▶ Watch the video

KV: the ring

Splitting the Ledger
Splitting the Ledger · Open board

One big book cut into several, with a rule that says which book each name goes into. This build writes that rule in Go, and then asks what happens to it on the day a new book arrives.

Before you start. Splitting the ledger (sharding) cut one book into several because one book, on one machine, could not keep up: every name had to live in exactly one of them, and a rule that anyone could work out on their own said which. Partitioning priced the part this lesson is about, which is what has to move when a machine joins. That is all you need: many machines, each holding a slice of the data, and a rule that picks the slice. This is the first of four builds; by the last one you will have a small key-value store (a program that stores a value under a name, like a coat check) spread across five machines, and you will kill two of them and watch it survive.

Continue reading with a plan

The first three lessons of every track are free. This lesson is included with a plan, which unlocks every lesson, board, video, lab and paper for one price.

View plans →Already a member? Sign in

Lab

Names are mostly A–D. You split A–M / N–Z. What happens?

Start on Split by letter, read the load bars under The books, then switch to Scrambled name and press Add a book.

Open Splitting the ledger →

The ring rehomes only 1/N of the keys when a server dies. So why does everyone run two hundred virtual nodes per server?

Drag Points on the ring per server from one upward, stay on Walk clockwise to the next server, and watch What the balance costs.

Open The ring →

Related paper

Review From Scratch →

Saved in this browser, and to your account when you sign in.