Comments (4)
* 1解决时钟回拨,时钟回拨后不可发号,必须要等到时钟追赶到回拨前的时间点。 如果时钟回拨了重启可立马发号,不会重复(重启重新分配的workerID)。 * 2不需要手动配置machineId,通过db table auto increment发号。直到workerID=2^n 用完为止,发号器剧终!
我在犹豫几百万次的重启次数够用了吗,真的要在数据库里面插入几百万次吗,而且这些记录基本没有什么其他用处的
百万次重启次数通常足够,可以根据自己的适用场景设计清理策略,清理不需要的workId,如 workId自增数到达 10w 的倍数触发异步清理之前的数据,其实这个问题是由于没有回收机制导致的,也可以每小时向 mysql 中更新自己workId 所在的记录,每天清理更新时间 < 当前时间 - 24 小时的
上面仅仅是举例,如果发现默认设计不能很好的应对自己的业务场景,推荐考虑根据自身的场景量体裁衣。
from uid-generator.
该方案和雪花ID的最大区别,我认为就是解决了时间回拨问题。
from uid-generator.
- 1解决时钟回拨,时钟回拨后不可发号,必须要等到时钟追赶到回拨前的时间点。
如果时钟回拨了重启可立马发号,不会重复(重启重新分配的workerID)。 - 2不需要手动配置machineId,通过db table auto increment发号。直到workerID=2^n 用完为止,发号器剧终!
from uid-generator.
* 1解决时钟回拨,时钟回拨后不可发号,必须要等到时钟追赶到回拨前的时间点。 如果时钟回拨了重启可立马发号,不会重复(重启重新分配的workerID)。 * 2不需要手动配置machineId,通过db table auto increment发号。直到workerID=2^n 用完为止,发号器剧终!
我在犹豫几百万次的重启次数够用了吗,真的要在数据库里面插入几百万次吗,而且这些记录基本没有什么其他用处的
from uid-generator.
Related Issues (20)
- There is a vulnerability in spring 4.2.5.RELEASE,upgrade recommended
- There is a vulnerability in logback 1.1.3,upgrade recommended
- Synchronized DefaultUidGenerator & ParallelGenerate
- 压测的具体操作方法能麻烦提供一下
- 64位虚机里 CacheLine 填充过长问题 HOT 1
- 中文文档里的sql建表语句执行报错 时间字段需要设置默认值 HOT 1
- 总共没几条sql,建议直接使用jdbc,不要在使用mybatis等框架 HOT 2
- 控制台日志频繁打印 HOT 1
- 请问该项目是不再维护了吗
- A component required a bean of type 'com.github.wujun234.uid.impl.CachedUidGenerator' that could not be found. HOT 1
- 为啥不把delta seconds和worker id换个位置? HOT 1
- AtomicLong.updateAndGet()超级费CPU,并发一多就100% HOT 1
- 这个吞吐量怎么算出来的?
- BufferPaddingExecutor中的lastSecond的疑问
- 报错 UidGenerateExption :java.RuntimeExecption :Rejected take buffer . RingBuffer [bufferize=65536,tail=65536,cursor=65536,paddingThreshold=32768] HOT 5
- 机器 id,最多可支持约 420w 次机器启动 HOT 2
- 时间戳运算代码是不是写错了 HOT 1
- 有没有升级为springboot版的 HOT 1
- No qualifying bean of type 'com.github.wujun234.uid.UidGenerator' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@jakarta.annotation.Resource(shareable=true, lookup="", name="", description="", authenticationType=CONTAINER, type=java.lang.Object.class, mappedName="")}
- 什么时候出个go语言版本的
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uid-generator.