I am writing a software where my code runs on two different machines. Will my GUID be still unique across the whole cluster if I have generation logic on multiple JVM.what are chances of collision in my specific use case ?
Asked
Active
Viewed 2,560 times
2
-
Possible duplicate - http://stackoverflow.com/questions/2513573/how-good-is-javas-uuid-randomuuid – mre Mar 16 '13 at 16:29
3 Answers
1
If your "GUID" is a UUID.randomUUID()
then the probabilities are quite low. Otherwise, it depends on how you are generating your GUID, but the general principle
behind them is that you have enough random bits so that a collision will be unlikely.
1
Just in case all instances of your distributed system use a common database, then you could create a sequence on that database and use values from that sequence to avoid duplicate IDs.

Andreas Dolk
- 113,398
- 19
- 180
- 268
-1
GLOBALLY unique ID, in this case global means universal.
Every GUID generated is guaranteed to be unique in the universe. That's the whole purpose of GUIDs.

user2177447
- 7
- 1