Re:Sortable Collision-Free UUIDs
by kpdemetriou on Monday May 03, 2021 @07:42PM
(#27032334)
Hi everyone, OP here. Let me offer some background. fuuids are designed to be sortable and collision-free (for most practical purposes, details below) IDs within a 16-byte footprint making them interpretable as UUIDs.
Lazare very helpfully detailed the internals of the two available formats but I'll summarize them here and I'm happy to answer any questions:
Format A (fuuid) consists of a 4-byte second timestamp concatenated with a 12-byte random tag.
Format B (fuuid_ns) consists of an 8-byte nanosecond timestamp concatenated with an 8-byte random tag.
As far as collision resistance is concerned, here's a list of probabilities at various production rates for Format A. Collisions for Format B are only relevant when the production rate begins to approach 10^9 IDs per second (assuming IDs are produced uniformly in time).
Lazare very helpfully detailed the internals of the two available formats but I'll summarize them here and I'm happy to answer any questions:
Format A (fuuid) consists of a 4-byte second timestamp concatenated with a 12-byte random tag.
Format B (fuuid_ns) consists of an 8-byte nanosecond timestamp concatenated with an 8-byte random tag.
As far as collision resistance is concerned, here's a list of probabilities at various production rates for Format A. Collisions for Format B are only relevant when the production rate begins to approach 10^9 IDs per second (assuming IDs are produced uniformly in time).
- 2^-90.51 at 10 IDs/second
- 2^-83.73 at 100 IDs/second
- 2^-77.07 at 1,000 IDs/second
- 2^-70.42 at 10,000 IDs/second
- 2^-63.78 at 100,000 IDs/second
- 2^-57.14 at 1,000,000 IDs/second
Hope this helps!