3 ms·
Two reasonable choices. 1. Cast your ids to strings and handle them as strings everywhere. 2. Just use 64 bits. If you have a pentillion of anything it won't
by lacker 19y ago
Two reasonable choices.
1. Cast your ids to strings and handle them as strings everywhere.
2. Just use 64 bits. If you have a pentillion of anything it won't be you fixing the problem any more.
- stcredzero 19y agoIIRC, the application I am working on right now uses 128 bit ids. In fact, I believe that they are just randomly generated. Since each row we fetch is already quite large, the extra 64 bits isn't much of a cost, but the ability to generate new IDs without any overhead or communication between processes is very beneficial. (The app is distributed between as many as 300 machines, all of which try their best to keep in sync with each other in realtime.) We just have to be careful about how the id generators are seeded.
- bosky101 19y ago300 machines ? nice! btw,did u use distributed erlang.and how do u make sure they unique ?
- stcredzero 19y agoActually, it's not Erlang, but Smalltalk. We don't have to make sure they're unique, that's the whole point. There are far less than 4 billion objects in the system. The changes of a collision are minuscule.