netty: Multi threaded behavior with UDP server does not seem to work (4.0.6.Final)
I’ve setup an UDP server as defined here : https://github.com/netty/netty/blob/master/example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentServer.java
group = new NioEventLoopGroup(ioThreadsNumber);
channel = new Bootstrap()
.group(group)
.channel(NioDatagramChannel.class)
.handler(serverChannelInitializer)
.bind(host, port)
.sync().channel();
ioThreadsNumber value is 10, and there is no EventExecutorGroup setup in channel pipeline defined in serverChannelInitializer.
I’m trying to do some load testing on my UDP server by sending multiple UDP packets concurrently.
Unfortunatelly my UDP server seems to be mono threaded and only uses nioEventLoopGroup-2-1 (even if there are some incoming UDP messages with different source port).
Is my server setup OK ? Is there any issue with UDP server multi threading ?
Thanks in advance,
About this issue
- Original URL
- State: open
- Created 11 years ago
- Comments: 50 (17 by maintainers)
Figured it out – the receiving OS chooses which thread’s socket receive buffer to put the datagram on based on the peer IP and port number (and its own). Altering the Python script to create and close a new socket for each datagram sent allowed the echo server to use all threads because each new sending socket gets a new peer port number. This was a newbie mistake on my part but I hope this information will be useful to others who come across this issue page. Thanks guys
@normanmaurer I have read the suggestions above, but it sounds like a kind of hack for an actually solvable problem (within Netty). While I would not exclude such an approach, it is definitely not my favourite one.