All Questions
Sharding medium

Distributed ID generators like Twitter's 'Snowflake' create 64-bit unique IDs using a format like `[Timestamp] + [Machine ID] + [Sequence]`. Why is the Timestamp placed first (the most significant bits)?

  1. A To allow the IDs to be automatically compressed by specialized network protocols.
  2. B To ensure that IDs are perfectly random and impossible to predict for security purposes.
  3. C To make the IDs 'K-Sortable' (roughly ordered by time), which allows database B-Tree indexes to remain efficient by appending new records at the end rather than inserting randomly.
  4. D To make the ID compatible with legacy 32-bit systems that only understand time-based integers.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions