Different strategies to generate UUIDs

UUIDs are widely used in distributed systems from tagging objects with an extremely short lifetime, to reliably identifying very persistent objects across a network. UUIDs are of a fixed size (128 bits) which is reasonably small compared to other alternatives and hence is widely used for problems such as sorting, ordering, and hashing, primary key attribute in database, transactionIds etc.

The IETF RFC 4122 defines 4 different strategies to generate UUIDs.

  • The Time-based version - You can also configure a generator that uses the Mac address of the machine and a timestamp (IETF RFC 4122 Version 1).
  • DCE Security version, with embedded POSIX UIDs
  • The Name-based version using MD5 hashing
  • The randomly or pseudo-randomly generated version - The default strategy generates the UUID based on random numbers (IETF RFC 4122 Version 4).
  • The Name-based version using MD5 hashing

Using these strategy, each distributed component can generate a UUID and it does not require a central authority/component to administer them. Since UUIDs are unique and persistent, they are also widely used for Uniform Resource Names.

The unique ability to generate a new UUID without a registration process allows for UUIDs to be one of the URNs with the lowest minting cost. The UUID generation algorithms specified by the standard can support very high allocation rates of up to 10 million per second per machine.


# Reference
1 https://www.ietf.org/rfc/rfc4122.txt

Version History

Date Description
2016-09-08 Initial Version