Unique ID Generator diagram template

Time-ordered 64-bit identifiers from many generators without central coordination.

Unique ID Generator architecture diagramOpen in ArchBoard

Builds a new scene in your browser. Your existing scenes are not touched.

About this design

Auto-increment columns stop working the moment data spans several databases, and a single ticket server becomes a bottleneck and a single point of failure. The Snowflake style answer packs a timestamp, a machine identifier and a per-millisecond sequence into 64 bits, so every generator can mint ids independently and they still sort roughly by time. The only coordination happens at start up, when a node claims a unique machine id from a small coordination store. Services call the generator through a library or a thin service, and clock drift is guarded by refusing to issue ids if time moves backwards. Use this template to discuss bit allocation, what happens on a leap second or a restart inside the same millisecond, why ULIDs and UUIDs trade ordering for simplicity, and how ids interact with database index locality.

Diagram as text

This is the source of the diagram, in the ArchBoard diagram DSL. Paste it into Tools, Diagram from text to rebuild or change it.

title "Unique ID generator"
direction LR
service orders "Order service" -> service idgen "ID generator"
[idgen x3]
service users "User service" -> idgen
idgen -> db postgres "Machine id registry"
monitor prometheus "Clock drift alerts"
idgen -> clock-drift-alerts

More interview classics templates