문제

Is it possible for Netty to create a worker thread that does all the sends for a group of sockets? It appears that currently, netty posts outbound messages to a queue and attempts to wake up the selector which then copies the data into an unused buffer and sends it. This takes time. Is it possible to send directly from a different thread?

도움이 되었습니까?

해결책

It is not possible. Netty has no idea about from which thread a user will call write(). Therefore, it needs a write request queue and a dedicated loop to perform writes. Otherwise the application will suffer from contention depending on how a user wrote his/her application. Under load, having a dedicated I/O loop and running a protocol with pipelining seem to yield higher throughput.

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