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: Decentralized, k-ordered unique IDs in Clojure

53 pointsby llambdaalmost 11 years ago

5 comments

dantiberianalmost 11 years ago
Very nice. This is based on Boundary&#x27;s Erlang Flake ID service, more details of which are at <a href="http://boundary.com/blog/2012/01/12/flake-a-decentralized-k-ordered-unique-id-generator-in-erlang/" rel="nofollow">http:&#x2F;&#x2F;boundary.com&#x2F;blog&#x2F;2012&#x2F;01&#x2F;12&#x2F;flake-a-decentralized-k-...</a>.<p>One thing I had to look up again was the definition of k-ordering: K-ordering gives <i>roughly</i> time-ordered id&#x27;s down to the millisecond when sorted lexicographically. This is usually fine for most purposes but keep in mind it doesn&#x27;t allow you to reason about causality between timestamps from different machines.<p>This also relies on your servers clocks to be in sync (something that should be happening anyway).
评论 #8204399 未加载
VLMalmost 11 years ago
&quot;So this allows for 2^16-1 unique IDs per millisecond per machine.&quot;<p>Technically thats per MAC not per machine. I&#x27;ve run into multiple NICs with duplicate MACs as has everyone else who&#x27;s been in the game long enough.
评论 #8214483 未加载
mumrahalmost 11 years ago
Neat! I made one of these in Java a while back after reading the snowflake Twitter post (which has since been removed). Looks like Twitter has retired Snowflake: <a href="https://github.com/twitter/snowflake" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;twitter&#x2F;snowflake</a><p><a href="https://github.com/mumrah/flake-java" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mumrah&#x2F;flake-java</a>
dtauzellalmost 11 years ago
What happens if your system clock goes backwards? I think that NTP will not do this by default, but I wonder if it happens for other reasons.
评论 #8204975 未加载
espeedalmost 11 years ago
Simpleflake is a 64 bit alternative <a href="http://engineering.custommade.com/simpleflake-distributed-id-generation-for-the-lazy/" rel="nofollow">http:&#x2F;&#x2F;engineering.custommade.com&#x2F;simpleflake-distributed-id...</a>