| That's not as much as you might think in computer systems. Now, if you want to mark your product SKU with an UUID you have an outstanding chance it'll be unique amongst other UUID SKUs in the scope of every shop selling your SKUs. But people have been captured by the idea UUID is truly "universally unique", so you can use it for everything, at any volume. Not at all. Let's say that we're implementing a distributed Actor system (or a similar message passing architecture) at the scale of Google. We'll be using UUID to tag every message to guarantee its identity and various messaging properties (like deliver just once etc.), because UUID is unique. While actor systems can reach millions of messages per server per second, here we'll use a humble 100k messages per second. - They have over 2 million servers (2,000,000) - Each of which generates 100k messages per second. You reach a point of 50% collision rate (for every new UUID) in 3 years: log2 (2,000,000 * 100,000 * 3600 * 24 * 365 * 3)= ~64
2^64 is roughly the number of 128-bit UUIDs you need to reach that collision rate due to the Birthday paradox.Now you might say, I have a lot of variables pegged to worst case scenario. Sure I have. But this is about 50 damn percent chance of collision on every new UUID generated at that point. Things will become bad long before 50% collision chance if you use UUID. |
That's incorrect. If you go back to the birthday paradox, what you say would mean that, if you have 23 people in a room, and a 24th walks in, there is a 50% chance that that new person shares their birthday with one of those 23. That clearly is incorrect; that probability is at most 23/365 < 0.10.
Also, I don't see how your formula proves it. You will go through 64 of the 128 bits of key space in 3 years, but that means you only got through 2^-64 part of the key space, so each next UUID has a chance of about 2^-64 of a collision.
It's the sheer number of lottery draws with ever increasing probability of a loss that introduces the birthday paradox, not the last lottery.