Universally Unique Identifer (Uuid)

UUID is a 128-bit number of an unique id. It has very low chance of getting collision.

According to Wikipedia, generating 1 billion UUIDs every second for 100 years the probability of creating a single duplicate reach 50%.

Example of UUID:

09c93e62-50b4-468d-bf8a-c07e1040bfb2

We can use this independently in each server:

Pasted image 20230701005933.png

Pros:

  • Simple, no dependency, dont need to synchronise
  • Easy to scale because ID gen is in the webserver itself

Cons:

  • 128 bit long, might be too much for some system
  • ID does not scale with time
  • ID can be non-numeric