Git Product home page Git Product logo

Comments (9)

carvinhappy avatar carvinhappy commented on July 24, 2024 5

@icanfly 这样每次重启取新的workerId应该是为了解决重启时服务器时间发生回拨的问题。

from uid-generator.

kangwen avatar kangwen commented on July 24, 2024 1

@zer0Black 你这个想法没错,但是可能存在workid不够用的情况。

只能调整worker位数了, 默认前面的delta seconds才8.5年,worker nodes如果22bit即使支持420万次 也是徒劳。况且产线的一个发号服务怎么会天天重启,一个月重启一次都嫌多。所以worker nodes必须要降位,worker nodes借3位给delta seconds。 delta seconds就能支持68年,这样worker nodes还能支持52万次。即使发号器集群有20台机器,平均一天重启一遍 也可能支持70年。 这才是一个均衡的思路。

from uid-generator.

zljgit avatar zljgit commented on July 24, 2024

单机部署多个实例或多个应用在一台主机上都依赖他生成id 就会出问题吧

from uid-generator.

icanfly avatar icanfly commented on July 24, 2024

@zljgit Idworker应该是一个服务集群,一台机器部署一个就没有这样的问题。如果在一台物理机环境下部署docker环境,docker也会有独立的IP和mac,所以我觉得这块问题不大。

from uid-generator.

80808746 avatar 80808746 commented on July 24, 2024

111

from uid-generator.

xingguang2013 avatar xingguang2013 commented on July 24, 2024

是否可以在应用的启动脚本中添加 -Dwork.id 参数,这样也可以避免同一台机器多个应用部署使用问题,也不会有 work.id 增加的情况。

from uid-generator.

zer0Black avatar zer0Black commented on July 24, 2024

这个方案会导致时间回拨产生的ID重复,请考虑如下一种场景:
服务实例关闭,时间回拨,重启服务实例
这时候重启实例,如果workid不变,可能会造成ID重复的问题。
但如果每次重启workid都变,即便时间回拨了,也可通过workid来保证生成生成ID不重复

from uid-generator.

pwh19920920 avatar pwh19920920 commented on July 24, 2024

@zer0Black 你这个想法没错,但是可能存在workid不够用的情况。

from uid-generator.

Viyond avatar Viyond commented on July 24, 2024

workerId的复用方案建议考虑下。

from uid-generator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.