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

关于线程分配问题 #7

Closed
l42111996 opened this issue Jul 26, 2018 · 1 comment
Closed

关于线程分配问题 #7

l42111996 opened this issue Jul 26, 2018 · 1 comment

Comments

@l42111996
Copy link

parent.eventLoop().register(child).addListener(new ChannelFutureListener() {

这里为何不像tcp一样创建一个work的eventloopgroup然后依次使用next分配线程 这样让UkcpServerChildChannel分配到不同的线程 这样更能使用多核。现在的所有连接的接入和收到消息都在同一个线程处理,这个线程很容易成为瓶颈

@szhnet
Copy link
Owner

szhnet commented Jul 30, 2018

因为这些childChannel最终都是通过共用一个DatagramChannel进行读写的,为了线程安全,所以将这些childChannel都放到了同一个线程进行处理。如果想利用多核,可以bind多个端口,这样每个端口对应一个DatagramChannel,对应一个线程。

@szhnet szhnet mentioned this issue May 31, 2019
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

2 participants