Skip to content
Theory · Unique ID generator · lesson 6 of 10

Time, node and counter in one number

Up to 2,000 processes issue IDs at once, and none of them asks the others whether a number is free. So why do the numbers never collide? The layout that makes this work was invented at Twitter and called Snowflake, and interviewers recognize it by name. But they expect an explanation, not a name: why two generators never collide, why one never repeats itself, and why the numbers sort by time.

In this lesson

  • How the number is built
  • Why the order follows time
  • Why the numbers never collide
  • Why a number must never be lost
  • What to compare it with in an interview
  • Common mistake
  • Key points