When a session ID is created, the ID isn’t checked for uniqueness usually. Verifying uniqueness is a big overhead when dealing with billions of records.
I was wondering what length of a random session ID string should be enough to rely on for uniqueness in a production service, as big as Gmail for example.
Any other suggestions to maintain a proper session uniqueness will be welcome.
Thanks,
Roy.
If you have a fairly good random number generator, a random 128-bit ID (such as a GUID) should be always unique in practice (mathematically speaking, there’s a tiny tiny chance that there will be duplicates, but trust me, it’s not going to happen. The universe will collapse in a giant black hole before there will be a duplicate GUID.)