5 ms·
What are the benefits of Snowflake compared to ULID, which already has Rust implementations[1][2]? [1] https://crates.io/crates/ulid https://crates.io/crates/u
by bojanz 6y ago
What are the benefits of Snowflake compared to ULID, which already has Rust implementations[1][2]?
[1] https://crates.io/crates/ulid https://crates.io/crates/ulid
[2] https://crates.io/crates/rusty_ulid https://crates.io/crates/rusty_ulid
- anomaloustho 6y agoNot sure if this is also a limitation of Snowflake. But ULIDs are only unique down to a certain timescale. (milliseconds I believe)
- sylvain_kerkour 6y agoNot exactly, They can be sorted, by default, only down to a millisecond, but you can use a monotonic generator to have them sorted, even if more than one Ulid is generated within a millisecond. Other than that, they have 80 bits of randomness, enough to be unique even if millions are generated per second. https://github.com/ulid/spec https://github.com/ulid/spec
- abahlo 6y agoSonyflakes are generally more useful in massive scale environments as you won't run into conflicts due to the "machine-id" part (which defaults to the lower 16 bits of the private IP address). There are more differences (128bit vs 64bit, rng vs time-based), I think they have different use cases.
- eutectic 6y agoYou shouldn't ever have a collision with 128 bits of entropy.
- j-pb 6y agoMore structure actually increases the chance for collisions. Because at that scale the chance of bit errors is dominating the equation. More rng protects against that.
- ComputerGuru 6y agoUlid doesn’t have a “machine id” or “node id” component. I think you are mixing it up with one of the uuid variants.