the most common way of generating unique ideas is to use some auto_increment
function of the SQL of choice. Unfortunately, in distributed systems this won't cut it.. but why?
On s single server app without much traffic, this may work, as there won’t be any concurrent ID generation, like there will be in a multi-server application. i.e. this feature can result in conflicts when implemented in distributed environments
The IDs need to be unique, but should they have more features? → Yes, as well as miminimizing the duplicated to basically 0, we should be able to sort IDs by time
How big can a single ID be? → 64 bits
How many IDs are we expected to generate? → Potentially billions
Should we support unique ID generation in distributed environment? → Yes, we will be working in distributed environment as we expect our application to scale horizontally with time
n1 → 0,2,4,6
n2 → 1,3,5,7
The limitations of this approach are that we won’t be able to sort the IDs by time as required and adding/removing nodes/servers to our system will bring a great deal of complexity and potential duplication in the ID generation process