Question

Is netty's udp running in single-threaded mode?

I have configured the NioDatagramChannelFactory like below:

new NioDatagramChannelFactory(Executors.newFixedThreadPool(4), 4));

But, when I running the code as a server, and lunch more than 20 clients to send udp packages continuously to it, the server still use only one worker thread.

Why?

Was it helpful?

Solution

Normally it should use 4 worker threads here. So how are you seeing that it only use one thread ? Did you check with jstack to see how many worker threads are running ?

You should also use

new NioDatagramChannelFactory(Executors.newCachedThreadPool(), 4));

This should take care of having at max. 4 worker threads.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top