Many systems design questions are intentionally left very vague and are literally given in the form of Design Facebook. It's your job to ask clarifying questions to better understand the system that you have to build.
* IDs must be unique and sortable
* IDs should contain numeric values
* Should fit into 64 bit
* Should scale to 1ok per second
Generates Twitter-like Snowflake ids. In short, This is an id scheme to generate unique 64 bit ids which are roughly sortable across multiple systems without a central instance. The IDs are 64-bits in size and are generated with the combination of the following:
- Epoch timestamp in milliseconds precision - 41 bits
- Node ID - 10 bits. This gives us 1024 nodes/machines.
- Sequence Number - Local counter per machine - 13 bits (Theoritically can generate 2^13-1 per milli second
https://github.com/spatnaik77/system-design-examples/blob/master/src/idgenerator/IdGenerator.java
- https://instagram-engineering.com/sharding-ids-at-instagram-1cf5a71e5a5c
- https://blog.twitter.com/engineering/en_us/a/2010/announcing-snowflake
- https://www.callicoder.com/distributed-unique-id-sequence-number-generator/
- https://github.com/phxql/snowflake-id