Distributed id generation system–summary
UUID
Simple and easy to use, but when doing database sharding, UUID is not suitable as a partition Film key
For details, see Leaf——Meituan Dianping Distributed ID Generation System
snowflake
The performance is very high. The disadvantage is that it is easy to make mistakes if the time is called back or the time of each instance node is inconsistent.
For details, please refer to Leaf——Meituan review distribution ID generation system
Meituan’s open source Leaf
Support multiple generation strategies of different modes
- Number segment mode
- This mode needs to build a DB table, and a special service is needed to provide an interface for obtaining an id. There is a network delay
- Snowflake mode
In order to pursue higher performance, the Leaf service needs to be deployed through RPC Server, then only the leaf-core package needs to be introduced, and the ID generating API is encapsulated into the specified RPC framework.
See Leaf
sharding-jdbc open source primary key generation component
Simple and easy to use, you can specify workerId or If you don’t specify it, you can import it directly via jar
Baidu’s open-source uid-generator
You need to build a DB table, you need to have a special service to provide an interface to get ID, there is a network Delay
See uid-generator
distributed id for details Generation system-summary
UUID
Simple and easy to use, but when doing database sharding, UUID is not suitable as a sharding key
For details, see< span class="Apple-converted-space"> Leaf——Meituan Dianping Distributed ID Generation System
snowf lake
The performance is very high. The disadvantage is that if the time is called back or the time of each instance node is inconsistent, it is easy to make mistakes.
For details, please refer to Leaf— —Meituan Dianping Distributed ID Generation System
Meituan’s open source Leaf
Support a variety of different model generation strategies
- Number segment mode
- This mode needs to build a DB table, and a special service is needed to provide an interface for obtaining ID. There is a network delay.
- Snowflake mode
li>
In order to pursue higher performance, the Leaf service needs to be deployed through the RPC Server, then only the leaf-core package needs to be introduced, and the API that generates the ID is encapsulated into the specified RPC framework.< /p>
For details, see Leaf
sharding-jdbc open source primary key generation component
Easy to use , You can specify the workerId or not, and you can import it directly through the jar
Baidu’s open source uid-generator
You need to build a DB table, and you need to have a special service to provide ID Interface, there is a network delay
See uid-generator