Alternatives to UUIDs as network identifiers



To shorten the user/network identifier (beekeeper id) currently based on a 36 character UUID, we might choose the ULID, an universally-unique lexicographically-sortable identifier encoded as a 26 character string. On top of that, ULIDs have some other nice properties, enjoy reading its specification.




 01AN4Z07BY      79KA1307SR9X4MV3
|----------|    |----------------|
 Timestamp           Entropy
  10 chars           16 chars
   48bits             80bits
   base32             base32


Neuer Prototyp basierend auf RaspberryPi

There are definitively other ways to create good unique identifiers. From that list, we found ULIDs to have the most convenient properties, followed by sonyflake.

Package Id Format 0pPKHjWprnVxGH7dEsAoXX2YQvU 4 bytes of time (seconds) + 16 random bytes b50vl5e54p1000fo3gh0 4 bytes of time (seconds) + 3 byte machine id + 2 byte process id + 3 bytes random -Kmdih_fs4ZZccpx2Hl1 8 bytes of time (milliseconds) + 9 random bytes 20f8707d6000108 ~6 bytes of time (10 ms) + 1 byte sequence + 2 bytes machine id 01BJMVNPBBZC3E36FJTGVF0C4S 6 bytes of time (milliseconds) + 8 bytes random 1JADkqpWxPx-4qaWY47~FqI 8 bytes of time (ns) + 8 random bytes 5b52d72c-82b3-4f8e-beb5-437a974842c UUIDv4 from RFC 4112 for comparison

– via: Generating good unique ids in Go


To produce even shorter and more convenient unique identifiers, i started leaning towards sonyflake. A Sonyflake ID is composed of

39 bits for time in units of 10 msec
16 bits for a machine id
 8 bits for a sequence number

This will reduce the space required for addressing a network of telemetry nodes (aka. network owner / beekeepers id) down to a 15 character string. Things like 20f8707d6000108 don’t spell bad either.

What’s your opinion about that?