Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: 128bit flake id generator in go (library and server) (github.com/turbolytics)
2 points by dm03514 7 months ago | hide | past | favorite | 1 comment



Hello everyone! I'm researching how to generate guaranteed globally unique IDS, and have been reading about Twitter's snowflake ID:

https://en.wikipedia.org/wiki/Snowflake_ID

To understand it better I created a fun weekend flake id generator using go!

https://github.com/turbolytics/flake

Have you used flake ids before at a company? Have you ever had to globally identify billions of entities? How did you do it?

I often work at small scale, so self incrementing primary keys in DB or UUID as primary key serve me fine. Many years ago I was working at a company that had to globally identify clickstream events and that is where I was introduced to flake ids. We used a 64bit id for during that time.

I chose 128bit here to provide for 64bit milliseconds epoch, 48bit worker identifier (allowing for mac address) and 16 bits (65k ids) per millisecond for high throughput scenarios.

I'm not using this project and don't have any intention to, but I thought it was fun to do and to share :p




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: