문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top