fxlae / typeid-java

A Java implementation of TypeID (Type-safe, K-sortable, globally unique identifier inspired by Stripe IDs).
Apache License 2.0
22 stars 4 forks source link

在分布式系统,能否保证全局唯一 #2

Closed CollectBugs closed 9 months ago

CollectBugs commented 11 months ago

在分布式系统,能否保证全局唯一

fxlae commented 11 months ago

As far as I understand your question, it depends on your requirements. TypeIDs are based on UUID version 7. UUIDv7 is designed to minimize the risk of collisions to a very low probability by incorporating the current timestamp as well as a random number. Although there's a theoretical possibility of non-uniqueness, the practical likelihood of such an event in UUIDv7 is extremely low, depending on the amount of ids generated within the same millisecond. UUIDs in general are designed to be used in distributed systems.