#snowflake #system #id #twitter #unique #distributed #generate

snowflake_id

SnowFlake is an algorithm adopted by Twitter, whose purpose is to generate globally unique and trend-increasing IDs in a distributed system

2 stable releases

1.0.1 Sep 22, 2021
0.1.0 Sep 22, 2021

#39 in #snowflake

Download history 30/week @ 2024-02-24 1/week @ 2024-03-02 82/week @ 2024-03-30 14/week @ 2024-04-06 8/week @ 2024-04-13 33/week @ 2024-04-20 10/week @ 2024-04-27 2/week @ 2024-05-04

56 downloads per month

MIT/Apache

265KB
103 lines

SnowFlake is an algorithm adopted by Twitter, whose purpose is to generate globally unique and trend-increasing IDs in a distributed system.

How many globally unique IDs can the SnowFlake algorithm generate in the same millisecond? Number of IDs in the same millisecond = 1024 X 4096 = 4194304

let mut worker = Snowflake::new(1, 1);

let id = worker.next();

No runtime deps