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

A service creates multiple Disruptors #452

Open
wangshilong1996 opened this issue Mar 20, 2023 · 5 comments
Open

A service creates multiple Disruptors #452

wangshilong1996 opened this issue Mar 20, 2023 · 5 comments
Labels

Comments

@wangshilong1996
Copy link

wangshilong1996 commented Mar 20, 2023

Desktop (please complete the following information):

  • OS: [win10]
  • Version [e.g. 3.4.4]
  • JVM Version [1.8.0_221]

Additional context
image
image
image
image
Can I use Disruptor like this, and use new multiple instances in one service

@Palmr
Copy link
Contributor

Palmr commented Mar 20, 2023

Translations (courtesy of google translate):
Title = "A service creates multiple Disruptors "
Body= "Can I use Disruptor like this, and use new multiple instances in one service"

@wangshilong1996 wangshilong1996 changed the title 一个服务创建多个Disruptor A service creates multiple Disruptors Mar 21, 2023
@wangshilong1996
Copy link
Author

@Palmr Looking forward to your help

@Palmr Palmr added the question label Mar 21, 2023
@Palmr
Copy link
Contributor

Palmr commented Mar 21, 2023

@wangshilong1996 there should be no issues creating multiple instances of the Disruptor in once service.

From your code examples I could imagine a game server? In that case you may indeed want different queues per-game so that activity in one game does not affect the latency of another.

Hopefully that answers the question.

An aside: I see you're using handleEventsWithWorkerPool which is removed in Disruptor v4. Something to consider if it's a long-term project

@wangshilong1996
Copy link
Author

@Palmr During my testing, 6000 connections were tested, and I found that multiple instances had lost events, while one instance did not.

@cuicuicuinice
Copy link

@Palmr During my testing, 6000 connections were tested, and I found that multiple instances had lost events, while one instance did not.在测试过程中,我测试了 6000 个连接,发现有多个实例丢失了事件,而有一个实例没有。

因为事件太多,环形缓冲区被覆盖了,解决方案就是自己每次加入环形缓冲区的事后,判断下环形缓冲区还有没有空位,没有的话就先放到自定义的无限制队列里。

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

No branches or pull requests

3 participants