8 ms·
I forget the context but the other day I also learned about Snowflake IDs [1] that are apparently used by Twitter, Discord, Instagram, and Mastodon. Timestamp
by ekipan 7mo ago
I forget the context but the other day I also learned about Snowflake IDs [1] that are apparently used by Twitter, Discord, Instagram, and Mastodon.
Timestamp + random seems like it could be a good tradeoff to reduce the ID sizes and still get reasonable characteristics, I'm surprised the article didn't explore there (but then again "timestamps" are a lot more nebulous at universal scale I suppose). Just spitballing here but I wonder if it would be worthwhile to reclaim ten bits of the Snowflake timestamp and use the low 32 bits for a random number. Four billion IDs for each second.
There's a Tom Scott video [2] that describes Youtube video IDs as 11-digit base-64 random numbers, but I don't see any official documentation about that. At the end he says how many IDs are available but I don't think he considers collisions via the birthday paradox.
[1]: https://en.wikipedia.org/wiki/Snowflake_ID https://en.wikipedia.org/wiki/Snowflake_ID
[2]: https://youtu.be/gocwRvLhDf8 https://youtu.be/gocwRvLhDf8
- drchickensalad 7mo agoThat also looks like the widely used BSON ids, to anyone else interested
- buzzerbetrayed 7mo agoGetting the entire universe to agree on a single clock for creating timestamps sounds absurdly difficult. Probably impossible?
- ekipan 7mo ago"Agreement" of time is probably nonsense, yeah. I realized after posting so I edited in the parenthetical, but as [3] notes, locality probably makes this less of a real issue. Apparently with the birthday paradox 32 bit random IDs only allow some tens of thousands per second before collision chance passes 50%. Maybe that's acceptable? [3]: https://news.ycombinator.com/item?id=47065241 https://news.ycombinator.com/item?id=47065241
- speakeron 7mo agoThe temperature of the cosmic microwave background can be used as a universal clock.
- UltraSane 7mo agoSo can neutron star spin rates
- UltraSane 7mo agoNeutron star spins collectively can be used as a pretty accurate clock.
- CableNinja 7mo agoHow? You are here on earth, looking at a neutron star. It pulses about N times a minute. I am 5ly away, looking at the same neutron star. Yes, i see the pulses happening at about N times per second, but the pulse delay you see at time T(a) is not the same pulse delay i see at time T(a), it would be another 5 years before i see the same pulse you saw.
- Zambyte 7mo agoYou don't need the universe to agree. You need your ID system to agree within a reasonable margin of error.
- swiftcoder 7mo ago> [1]: https://en.wikipedia.org/wiki/Snowflake_ID https://en.wikipedia.org/wiki/Snowflake_ID Isn't this just the same scheme as version 1 UUID, except with half the bits? I guess they didn't want to dedicate 128 bits to their IDs.
- bricss 7mo agoThere also DRUUID: https://gist.github.com/bricss/53e5babedf44bf3ab71334c15102ed0a https://gist.github.com/bricss/53e5babedf44bf3ab71334c15102e...