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

channel pool 发送数据的问题 #47

Closed
zhwaaaaaa opened this issue Apr 7, 2019 · 2 comments
Closed

channel pool 发送数据的问题 #47

zhwaaaaaa opened this issue Apr 7, 2019 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@zhwaaaaaa
Copy link

zhwaaaaaa commented Apr 7, 2019

我初略看了一下你们这个源码。发现你们是从channel pool中获取一个channel,然后注册一个定时器timeout,然后做序列化,然后同步阻塞发送数据直到数据发送出去,然后回收连接。
我觉得可以换一个过程,可以省掉连接池,和定时器,不知道是否会对性能有提升。
先序列化 -> 在获取channel -> 发送数据(不需要等待数据发送出去,把数据交给netty排队)->设置定时器(使用socketChannel.eventLoop()的定时功能,把定时操作放在selector上)。
首先我觉得这个过程可以减少对每次发送对channel的占用时间,使用更少的channel就可以有相同的并发量,然后省掉了定时器线程

@guohao
Copy link

guohao commented Apr 7, 2019

+1
赞同取消同步写和 pooled 的方式,建议实现 Java 版本的 multi 连接方式

@wenweihu86
Copy link
Collaborator

@zhwaaaaaa @guohao
1、channel的获取确实是应该移到序列化之后发送之前获取比较好。
2、发送时不同步等待,会有问题,我之前试过;所以定时器也要放到发送数据之前生成。
3、定时器不希望占用IO线程。
4、multi连接方式可以添加,作为连接方式的一个补充,而不是替代。

@wenweihu86 wenweihu86 added the help wanted Extra attention is needed label Jun 3, 2019
guohao pushed a commit to guohao/brpc-java that referenced this issue Aug 21, 2019
guohao added a commit to guohao/brpc-java that referenced this issue Aug 21, 2019
guohao added a commit to guohao/brpc-java that referenced this issue Aug 22, 2019
@wenweihu86 wenweihu86 reopened this Aug 23, 2019
@tullyliu tullyliu closed this as completed Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants