TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: 128bit flake id generator in go (library and server)

2 pointsby dm0351411 months ago

1 comment

dm0351411 months ago
Hello everyone! I&#x27;m researching how to generate guaranteed globally unique IDS, and have been reading about Twitter&#x27;s snowflake ID:<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Snowflake_ID" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Snowflake_ID</a><p>To understand it better I created a fun weekend flake id generator using go!<p><a href="https:&#x2F;&#x2F;github.com&#x2F;turbolytics&#x2F;flake">https:&#x2F;&#x2F;github.com&#x2F;turbolytics&#x2F;flake</a><p>Have you used flake ids before at a company? Have you ever had to globally identify billions of entities? How did you do it?<p>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.<p>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.<p>I&#x27;m not using this project and don&#x27;t have any intention to, but I thought it was fun to do and to share :p