重用于“EventLoopGroup”

Reuse for `EventLoopGroup`

伙计们,你认为这是一个好策略吗? 尝试重用 nioEventLoopGroup 后面的线程 对于有很多 connect/disconnect 场景的服务器 ?

提前致谢。

这可能取决于您 "reuse" 的意思。但是一般来说 EventLoopGroup threads are used for I/O. One important characteristic of NIO (and may asynchronous networking stacks) is that it is designed to handle many I/O operations with a relatively small set of threads. If you start using the I/O threads for "time consuming" operations then you will take away from the time those I/O threads could be spending on I/O. If you have "time consuming" tasks (i.e. blocking tasks, expensive computations, etc...) you may want to consider dispatching these to an alternative Executor.