首页 > 数据库 > 数据库开发技术 > 推荐两款好用开源分布式id生成器

https://gitee.com/free/vesta-id-generatorhttps://gitcode.com/iweisi/vesta-id-generator/overview?utm_source=artical_gitcode&isLogin=1
https://blog.csdn.net/chenqiuge1984/article/details/80128916https://blog.csdn.net/u011673769/article/details/120776650https://blog.csdn.net/gitblog_00057/article/details/137166537https://blog.csdn.net/isea533/article/details/79754970
CosIdGenerator : 单机 TPS 性能:1557W/s,三倍于 UUID.randomUUID(),基于时钟的全局趋势递增ID,可以同时支持一百万个实例。SnowflakeId : 单机 TPS 性能:409W/s [JMH 基准测试], 主要解决 时钟回拨 、机器号分配、取模分片不均匀 等问题并提供更加友好、灵活的使用体验。SegmentId: 每次获取一段 (Step) ID,来降低号段分发器的网络IO请求频次提升性能。并提供多种号段分发器实现。https://cosid.ahoo.me/guide/faq/perf-test.html
PrefetchWorker 维护安全距离(safeDistance), 并且支持基于饥饿状态的动态safeDistance扩容/收缩。SegmentId,SegmentChainId 可以根据业务场景动态调整 Step 来提升性能。https://cosid.ahoo.me/guide/introduction.htmlhttps://gitee.com/AhooWang/CosIdhttps://github.com/Ahoo-Wang/CosId
https://cosid.ahoo.me/guide/faq/Performance-CosId-Leaf.htmlSegmentChainId) 性能是 Leaf (segment) 的 5 倍。AtomicLong https://mybatis-flex.com/zh/core/id.htmlmybatis-flex内置三种id生成实现:
uuid:通过 UUIDKeyGenerator 生成 UUID 作为数据库主键。
flexId:独创的 FlexID 算法生成数据库主键(了解更多信息请参阅源码)。
snowFlakeId:通过雪花算法(SnowFlakeIDKeyGenerator)生成数据库主键。
原文作者:Java大飞哥;如有侵权,请联系管理员删除。