Influence a team on serial numbers size

Once, when I just joined my last team I was looking through team members' tasks and code reviews to learn more about this team problem space.

One day I noticed that an engineer made a code change to move a serial number generation from a distributed sequential counter to a pseudo-random generation of 64 bits. According to the birthday paradox, we would need to generate sqrt(2⁶⁴) = 2³² = 5 billion serial numbers to get the first collision. I calculated that we were generating 2.5 billion serial numbers a day. In one day we would have the first collision and then a number of collisions would only grow exponentially (according to the same paradox).

I checked that collisions would have unintended consequences with some clients if they get collided serial numbers. Then I read that the standard allows using 160-bit serial numbers. A migration to them with pseudo-random generation would give us the first collision in one trillion years (2⁸⁰/10⁹ / 30 / 12).

I wrote all my findings in a document and presented it to the engineer. He agreed to my conclusions and I socialized the document with the team. Everyone in the team agreed to it as well. I offered my help to implement 160-bit serial number support, finished it, and rolled it out to production. I was able to influence the team to choose the right long-term approach and avoid collisions.


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store