Let's assume our Netty server (4.1.32) responds HTTP calls. Let's further assume it must perform certain blocking actions before incoming requests can be answered, for example, it must perform an outgoing call (using a different library here) to load external data.
Number of threads for NioEventLoopGroup with persistent connections dicusses
What happens if my messageReceived method blocks on something or takes a long time to complete?
which @Maksym responds with
You should avoid using thread blocking actions in your handlers.
It's clear there is only a limited number of worker threads. So blocking all available worker threads effectively means Netty will queue any further requests, until worker threads become available.
On the other hand, moving blocking actions onto my own threads as suggested, will have performance impact for thread switching, and what will in turn be blocked by the available hardware is my own thread pool. IMHO using my own thread pool only adds another layer of complexity, but does not enhance performance. Instead, I'd rather increase the maximum number of worker threads and have Netty do the job of queuing requests.
What is the suggested practice here?