0

I have a Netty 4 application that is receiving messages at high throughput using a single network connection (or to be precise, a single IP multicast group), so processing of all channel handlers in the pipeline is basically single-threaded.

Is there a way to configure Netty to parallelize processing so that more than 1 core gets used? I'm thinking of the "pipelining pattern" of multi-threading aka synchronous concurrency. Is something like that built-in - or would I have to implement this myself, off the Netty pipeline?

Evgeniy Berezovsky
  • 18,571
  • 13
  • 82
  • 156

1 Answers1

0

You can add different handlers with different EventLoopGroups to the pipeline. This way you can offload to different threads. That said you may need to be careful in terms of ordering (depending on the protocol)

Norman Maurer
  • 23,104
  • 2
  • 33
  • 31
  • Thanks Norman. Not sure about your heads-up regarding ordering. Are you saying that messages could come out in a different order at the end of the pipeline? In that case, I guess I just `new NioEventLoopGroup(1)` for every handler. As I only have one "connection", it should not hurt me performance-wise, but it would make sure that items cannot overtake another, right? (But I don't know if `NioEventLoopGroup` is the right implementation for channel-specific `EventLoopGroup`s...) – Evgeniy Berezovsky Dec 09 '20 at 00:19
  • Perhaps some descendant of `SingleThreadEventLoop` would be better - is there an example somewhere of handler-specific event loop groups that I can refer to? – Evgeniy Berezovsky Dec 09 '20 at 00:25