Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否能将号段模式和snowflake模式相结合以提高可用性,增强服务性能? #177

Open
liuheyong opened this issue Aug 21, 2021 · 2 comments

Comments

@liuheyong
Copy link

号段模式强依赖数据库,而snowflake模式一次又只能获取一个ID,是否可以进行以下两种模式合并:

依然采用snowflake和zookeeper结合的模式为其他系统提供生成ID的服务,但是支持批量取号,在调用的服务端结合号段模式的双buffer机制,其他系统在启动时获取一个列表ID号,待这个ID列表消耗10%的时候异步开启线程再次获取一个列表ID号,添加到之前那个ID列表中,每次消费10%往复如此。

@lj240556
Copy link

你在瞎提交什么问题,你了解什么是snowflake算法吗,就要批量获取?可真的是无知可怕

@ZEROAZERO
Copy link

ZEROAZERO commented Jun 2, 2024

个人理解 snowflake存在时间回拨问题,如果大批量预生成,出现重复的概率会更大

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants