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 12 · System Design · The questions that keep coming up · about 18 min to read

Watch: Instagram's 64-bit id: how thousands of databases hand out ids nobody repeats
▶ VideoPlay it as a journeyTutor comes with a plan

A number nobody else has (UUIDs, Snowflake ids, and a clock you cannot trust)

Sharding & IDs
Sharding & IDs · Open board

Instagram’s id built from a time, a shard and a counter, and the shard read back out of the id itself.

Before you start. You need sharding from Splitting the ledger (sharding): once the data is cut into pieces there is no single pen, so no single counter hands out the next number. Design the Whole Thing (the interview, assembled) gave the six steps, and the estimate step is where this lesson starts. Later in this track, Instagram, the case study tells Instagram’s id scheme in short, and here we take it apart first.

Lesson 74 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

  • 30 June 2012: the second that happened twice
  • The job: an id that is unique without asking anyone
  • UUID: label parcels with random digits
  • June 2010: Snowflake, 64 bits split three ways
  • Clock skew: the 20 ms that reorders everything
  • The clock that goes backwards
  • May 2024: the standard grows a time field
  • Ticket servers: give up on having no head office
  • Step 1, requirements
  • Step 2, targets
  • Step 3, estimates that change the design
  • Step 4, entities and API
  • Step 5, storage, with the trade said plainly
  • Step 6, the design, one requirement at a time
  • Deep dives
  • What each level adds
  • The follow-up: two events must be ordered exactly

Terms it explains: leap second, id, unique, UUID, Snowflake, worker, sequence, clock skew, to within the skew, refuses to make ids, UUID version 7, ticket servers, Common mistakes.

Review System Design