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 01 · System Design · The stall gets famous · about 19 min to read

Watch: Sharding: splitting the ledger
▶ VideoPlay it as a journeyTutor comes with a plan

Splitting the ledger (sharding)

Splitting the Ledger
Splitting the Ledger · Open board

The sequel The copy clerks (database replication) promised. The copy clerks gave the stall many books to read from, and every new order still went into one book, with one pen. This is the story of cutting that book up, and of the 1997 paper that made the cutting survivable.

Before you start. You need the copy clerks: one master book, several clerks holding copies, so a hundred people read at once. That lesson left one thing untouched, and this lesson breaks it, every new line still has to be written into the master, by one hand.

Lesson 5 of 115 in System Design

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

  • Peak hour, and the one hand that has to write
  • The cut: two books, two pens, and the shard key that decides
  • The A-names pile up: range partitioning and the hot shard
  • Scramble the names: hash partitioning, and the question it makes expensive
  • 1997, MIT: hot spots on the web, and the ring
  • One point per server is a bad cut: virtual nodes
  • Where the 80% comes from, by counting
  • What the points buy

Terms it explains: write throughput, shard key, shard, sharding, hot shard, range partitioning, hash partitioning, cache, origin, consistent hashing, virtual nodes, 2PC, saga, cross-shard query, range vs hash partitioning, resharding, shard key (partition key).

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 papers

Review System Design