Search code examples
clouduuid

Is it possible for a time-based UUID to be not unique in a cloud environment?


I may be completely wrong, but I have been reading about how UUID are created from https://www.famkruithof.net/guid-uuid-timebased.html.

It seems it is unique by using a timestamp and a mac address. My question then is say I am running some website on a cloud server such as Amazon Web Services. AWS may have one physical computer, but from that physical computer they offer instances. Say they have 10 instances available for that one computer and I take all 10 instances. I then create a web server on each of those 10 instances and start getting many requests on each instance (10000/sec +). The web server say generates a UUID for each request which will go into a database. Is it possible then if two or more instances get a request at the EXACT same time (same nano second) that they will generate the same UUID since all the instances also have the same MAC address?


Solution

  • An AWS instance is typically a virtual machine, and each virtual machine gets its own MAC address. The infrastructure handles the MAC address generation under normal circumstances, and should (in any case) ensure that no two instances have the same MAC address at the same time.