Remix.run Logo
benoau 4 hours ago

There is source code available for it (although the repo's retired):

https://github.com/twitter-archive/snowflake/blob/b3f6a3c6ca...

Basically one big server had a number of threads each requesting the next value in the sequence on that machine. The sequence only had to be unique to that machine and was just a counter of how many tweets since <last whole millisecond>. Tweets per millisecond per server was probably never a huge number, so they were able to share the 10 bits between datacenter id and that counter.