PUID - single service for all parcel identification number generator
Status
Accepted
Context
- Parcels do need one unique identifier. It is used for tracking, pricing, and other purposes.
- Production solution need to handle millions of parcels.
- PUID generation has to be as fast as possible therefore use of database for guarding uniqueness is not an option.
- PUID generation needs to scale (iops cannot be a bottleneck).
- PUID needs to consist of numbers only - scanner friendly.
- PUID needs to have possibility to work offline.
Decision
Twitter snowflake library meets almost all the requirements. It is fast, it scales, it is offline capable. At this stage offline generation is not supported by the service (but does not limit if such need arises).
Consequences
- Yet another service to maintain and orchestrate.
- PUID down = no new parcels. To avoid single point of failure, service needs to be HA (infrastructure complexity).