سؤال

We have a distributed application that uses Netty (4) for our low level communication stuff. A process in that system execute multiple tasks. Each task contains a set of input and output channels. Channels are permanently assigned to a single EventLoop in Netty. The mapping of Channel to EventLoop happens in round robin fashion in the (Nio)EventLoopGroup. We would like to have more control over this mapping and assign all channels of the same task to the same EventLoop(s). The purpose for this "Channel-EventLoop affinity" is to reduce lock-contention for some specific memory management stuff in the ChannelHandlers. We looked in Netty documentation, but didn´t find anything. Is there a general way to do that in Netty 4?

Another possibility I identified would be to overwrite the "EventExecutor next()" method in the "MultithreadEventExecutorGroup" that implements the round robin channel mapping (I think so at least). Is that a possible way to enforce a different mapping, or do I create undesirable side effects with this hack?

I am grateful for any help!! Tobi

هل كانت مفيدة؟

المحلول

It is not possible at the moment to do this in a "clean" way. We want to change it in netty 5. See also https://github.com/netty/netty/issues/1230

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top