DEV Community

Discussion on: From monolith to cloud: Auto Increment to UUID

Collapse
 
rhymes profile image
rhymes

You will have to get used to a more difficult debugging process, UUID’s are impossible to remember. The trick of memorizing the first or last characters will probably not work.

I feel KSUIDs are a good compromise. You have secure IDs like with UUIDs but they are roughly sortable (and you can memorize a bit): github.com/segmentio/ksuid

Collapse
 
bgadrian profile image
Adrian B.G.

Wow nice, my brain just got bigger.

Also I found this on the ksuid repo segment.com/blog/a-brief-history-o... which is a good extra for my article.

KSUID look nice, and knowing what Segment.io does I see their need for such a thing.

KSUIDs are 20-bytes: a 32-bit unsigned integer UTC timestamp and a 128-bit randomly generated payload. The timestamp uses big-endian encoding, to allow lexicographic sorting. The timestamp epoch is adjusted to March 5th, 2014, providing over 100 years of useful life starting at UNIX epoch + 14e8. The payload uses a cryptographically-strong pseudorandom number generator.

It is like a json web token with a timestamp and crypto-randomness, sounds like a cookie treat.