| ▲ | yakkasean 7 hours ago | |
It does look similar. I’m confused though how they coordinate sequence bits with only 2^10 (1024) workers. Surely they have more web servers than that, so sequence must be coordinated in a centralized way. Also, this is a 62 bit spec. | ||
| ▲ | benoau 4 hours ago | parent [-] | |
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. | ||