simonalong / butterfly Goto Github PK
View Code? Open in Web Editor NEW分布式ID生成器框架:超高性能的发号器框架。通过引入多种新的方案,彻底解决雪花算法的时间回拨等问题,并将雪花算法原生QPS提高最少十几~二十倍
Home Page: https://www.yuque.com/simonalong/butterfly
License: Apache License 2.0
分布式ID生成器框架:超高性能的发号器框架。通过引入多种新的方案,彻底解决雪花算法的时间回拨等问题,并将雪花算法原生QPS提高最少十几~二十倍
Home Page: https://www.yuque.com/simonalong/butterfly
License: Apache License 2.0
作者您好,低并发情况下生成出的id都是偶数 影响分库分表的公平性 ,做个问题能否优化
2021-05-11 11:28:54.871 ERROR [ ]- [main] c.s.n.Neo : [Neo] sql=> select max(work_id) from butterfly_uuid_generator where namespace = ? for update, parameters => [CustomerManage]
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1837)
at com.simonalong.neo.TableMap.put(TableMap.java:383)
at com.simonalong.neo.TableMap.put(TableMap.java:370)
at com.simonalong.neo.Neo.generateResult(Neo.java:2218)
at com.simonalong.neo.Neo.executeOne(Neo.java:2183)
at com.simonalong.neo.Neo.execute(Neo.java:1746)
at com.simonalong.neo.Neo.exeValue(Neo.java:798)
at com.simonalong.butterfly.worker.db.DbWorkerIdHandler.lambda$insertWorker$2(DbWorkerIdHandler.java:201)
at com.simonalong.neo.Neo.tx(Neo.java:1618)
at com.simonalong.neo.Neo.tx(Neo.java:1525)
数据库内之前add的namespace依然存在,删除后才不报错
I tried to review the interaction between the server side and the client side. It seems there is not a heartbeat mechanism so that the system relies on the hostid upward counting to avoid uuid duplication. I feel that this project is not fully completed.
看了以下服务端和客户端的交互代码,看上去客户端和服务器之间没有心跳,只能依靠hostid+1来避免重复发号,感觉这一块并没有完全做完。
问题描述
zookeeper分配workerId多节点同时启动时存在并发安全问题,存在多个节点分配同一个workerId的bug
问题出现步骤
参考如下示例:
期望结果
每个节点分配的机器位不相同
实际结果
我这边生产环境中碰到两个节点被分配了相同机器位,一个节点index为31创建session node成功,另外一个节点index也为31进来,删除了节点后,重新创建
部分节点重启后,新启动的节点时间戳比较大,生成的id也比较大,破坏了整体的自增性?
能否考虑在本机文件系统上缓存一个workerID文件。当ZooKeeper出现问题,恰好机器出现问题需要重启时,能保证服务能够正常启动。这样做到了对三方组件的弱依赖。一定程度上提高了SLA
历史时间自增1的设计,在长时间持续超高QPS的情况下,历史时间会一直自增直到超过当前实际时间,那么下次重启后历史时间又被重置为当前时间,也就可能生成重复id。
com.simonalong.butterfly.sequence.exception.ButterflyException: 回拨时间超过:2021-06-01 18:32:07.430
你好,我看了下您的代码,发现如果我要生成号码段的UUID,是否只能通过一个个getUuid来获取?
或者有其他接口可以进行获取,麻烦请告知。谢谢。
我用的是restful的方式。
正确的应该是:
butterfly-allocator-zookeeper
你写成了:
butterfly-zookeeper-allocator
Failed to get driver instance for jdbcUrl=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
Caued by: java.sql.SQLException: No suitable driver
正常走DB模式是无问题
如题
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.