🗓️ 21032024 1110
📎 #backend #id_generation
snowflake_id
Bits | Description |
---|---|
First 41 bits | Timestamp from a chosen epoch |
Next 10 bits | Machine ID |
Last 12 bits | Per machine sequence number - Incremented for each ID generated- Resets every millisecond |
Use case
- Generating MANY unique IDs in a distributed manner
- Capable of generating 4096 (2^12) IDs per millisecond per machine
WARNING
Machine clocks must be synchronised to prevent ID collisions