Is netty's udp running in single-threaded mode?
-
01-06-2021 - |
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?
La 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.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow