3 ms·
or just use UUIDs which are designed for this exact use case
by marcus_holmes 11y ago
or just use UUIDs which are designed for this exact use case
- vcarl 11y agoExactly, my biggest takeaway is "don't write your own unique ID algorithm." At best it does the same as existing methods, at worst you screw it up and end up here.
- dap 11y agoWhat kind of UUID? Standard UUIDs of versions 1, 2, and 3 are not really unique enough[1]. Version 4 is basically a random number, so it doesn't help to say "just use that". [1] https://en.wikipedia.org/wiki/Universally_unique_identifier https://en.wikipedia.org/wiki/Universally_unique_identifier
- marcus_holmes 11y agowell, I use uuidgen[1]. If I have to generate uuids for multiple servers, then I create a microservice to handle uuid generation, and get it to generate a few held in a buffer so the rest of the system doesn't have to wait for one. [1] http://man7.org/linux/man-pages/man1/uuidgen.1.html http://man7.org/linux/man-pages/man1/uuidgen.1.html