Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
这个pr会覆盖其他open的pr 536,539。
最近进行的测试,发现了SocketChannel的一些其他问题:
在构建新SocketChannel时,EventLoopGroup调next()就近分配EventLoop进行注册,经过长时间运行,某一个instance的channel如果期间中断过多次,可能round到一个其他instance的channel注册的EventLoop。由于没有在记录log前后设置MDC,日志会记到其他instance的日志文件中。多个channel共享一个EventLoop,轮流使用时间片会使读性能变差(如果消费的快)。
BIO使用较小的SO_TIMEOUT(1s),处理闪断和interrupt。
其他改动:READ_TIMEOUT_MILLISECONDS修改为(MASTER_HEARTBEAT_PERIOD_SECONDS + 10) * 1000.
+1s的情况,在一个instance无traffic放置一天的测试中,出现了几次读取header timeout,频率大致几小时一次。