While investigating a customer issue I was trying to figure out how to increase the size of the thread pool used by WebClient. It is obscure and undocumented.
From what I can tell the answer is that you need to add the following to application.yaml:
I could not find this in our documentation as there is no mention of the event-loop configuration in the docs, nor is there any support for it via the WebClient (builder) API. The bit about registering config in the globalContext() is especially obscure. The only way to figure this out is to look at source code:
But the example does not describe this, and in fact the example doesn't pick up the number of worker threads because it does not do Contexts.globalContext().register(config).
At a minimum we should add documentation for this. I assume in Helidon 4 this issue is not applicable because of our removal of Netty and use of VirtualThreads.
Environment Details
Problem Description
While investigating a customer issue I was trying to figure out how to increase the size of the thread pool used by WebClient. It is obscure and undocumented.
From what I can tell the answer is that you need to add the following to
application.yaml
:And then do this before you build the WebClient:
I could not find this in our documentation as there is no mention of the
event-loop
configuration in the docs, nor is there any support for it via the WebClient (builder) API. The bit about registering config in theglobalContext()
is especially obscure. The only way to figure this out is to look at source code:https://github.com/helidon-io/helidon/blob/0c11b0446d57ef5fffaf1c38c53949448228edc9/webclient/webclient/src/main/java/io/helidon/webclient/NettyClient.java#L60
The only place I have seen any indication of the ability to set the number of worker threads in here:
https://github.com/helidon-io/helidon-examples/blob/53ad7a82789dfd00f4565e8beb36acafd75ea670/examples/webclient/standalone/src/main/resources/full-webclient-config.yaml#L19
But the example does not describe this, and in fact the example doesn't pick up the number of worker threads because it does not do
Contexts.globalContext().register(config)
.At a minimum we should add documentation for this. I assume in Helidon 4 this issue is not applicable because of our removal of Netty and use of VirtualThreads.