Hacker News new | past | comments | ask | show | jobs | submit login

I like how MongoDB does this:

http://docs.mongodb.org/manual/reference/object-id/

They start with a timestamp and are fully distributed. In the official linux client library, the "3 byte machine id" is the first 3 bytes of the md5 hash of the hostnames. As long as you can guarantee uniqueness there, there are no collisions.

For a large API, one could generate their own machine ID's and provide a strong guarantee on uniqueness.

The one criticism with MongoDB's approach is that the ID is 12 bytes and doesn't fit very well in column types offered by other DBs




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

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

Search: