Re:SCRU128: Sortable, Clock and Random number-based Unique i...
by danbruc on Thursday April 21, 2022 @04:57PM
(#31115082)
Misses the most important section - why yet another monotonic UUID? What issues in order implementations does this one solve? And is it an actual improvement or does this one just pick a different trade off?
Re:SCRU128: Sortable, Clock and Random number-based Unique i...
by aseipp on Thursday April 21, 2022 @02:53PM
(#31113700)
The intent of these IDs is to be used e.g. as primary keys in a database, and the timestamp improves sortability, helping the database engine pack tuples that are related "in time" into the same pages, which decreases the need for seeks. You can't split the ID and timestamp fields apart; the intent is that they are spatially and temporally related.
Re:SCRU128: Sortable, Clock and Random number-based Unique i...
by stevesimmons on Thursday April 21, 2022 @05:30PM
(#31115432)
I use a format I call id25, with takes a time-sorted UUIDv7, and represents its 128 bits as 25 chars from a Base 35 alphabet which has 0-9, a-k, m-z.
Since I could drop one char from Base 36, and still store 128 bits, I decided to drop the "l", to reduce ambiguity with "1". And since I used lower case letters, "o" and "0" look quite different.
Re:SCRU128: Sortable, Clock and Random number-based Unique i...
by cabirum on Thursday April 21, 2022 @01:10PM
(#31112202)
I think it should be customizable: let users pass the number of bits for time, and the number of bits for randomness. Maybe also add fixed bits for partitioning.
128 bits is often an overkill when dealing with single-digit rps.
Re:SCRU128: Sortable, Clock and Random number-based Unique i...
by throwaway81523 on Thursday April 21, 2022 @07:40PM
(#31116534)
> SCRU128 gives some random bits a longer life to reduce the number of random number generation per a unit of time. As a result, even if each of multiple generators generates a million IDs at the same millisecond, no collision will occur as long as the random numbers generated only once per second (per_sec_random) differ.
This is perplexing and I'd like to see the assumptions spelled out about how many such generators will run at the same time. If there are 1000s of generators, that almost guarantees occasional free collisions in the per-second field. If two such colliding generators each make a million ID's in the same millisecond, that basically guarantees full 72-bit collisions. Plus the monotonically increasing counter field can be a technical challenge in its own right. If you can generate those reliably and want to make the uuid's opaque to attackers, you might as well just encrypt a 64-bit monotonic counter with a 128 bit block cipher, with your db able to decrypt the counter for indexing purposes.
If you have an overflow condition you want to encounter (i.e. test) it often.
32bit miliseconds + 96 bit of real entropy is brute force resistant, and has a ~50 day overflow period.
That's plenty for eyeball statistics and to make DB indices happy.
Any more sophisticated analytics will require larger precision and timezoning anyways, so don't cram it into the ID and give it it's own field.
Also don't muck with entropy. All these smart counter schemes are potential attack vectors and have a much higher collision probability.
You're more likely to get a collision due to but flips in such a counting scheme than from two randomly colliding full entropy bitstrings.
You can do both, use a low precision timestamp with overflows in the ID to keep the index happy, and add a proper timestamp field for analytics.
The 32 + 96 split is what postgres uses for example. I'd say that's a pretty good endorsement.
Since I could drop one char from Base 36, and still store 128 bits, I decided to drop the "l", to reduce ambiguity with "1". And since I used lower case letters, "o" and "0" look quite different.
128 bits is often an overkill when dealing with single-digit rps.
This is perplexing and I'd like to see the assumptions spelled out about how many such generators will run at the same time. If there are 1000s of generators, that almost guarantees occasional free collisions in the per-second field. If two such colliding generators each make a million ID's in the same millisecond, that basically guarantees full 72-bit collisions. Plus the monotonically increasing counter field can be a technical challenge in its own right. If you can generate those reliably and want to make the uuid's opaque to attackers, you might as well just encrypt a 64-bit monotonic counter with a 128 bit block cipher, with your db able to decrypt the counter for indexing purposes.
https://www.ietf.org/archive/id/draft-peabody-dispatch-new-u...