13

While using Spring 5 reactive webflux with Spring boot 2.0, what's the default number of threads used to handle requests? How can I configure the number of threads used?

2 Answers 2

11

The default number of threads for request handling is determined by the underlying web server; by default, Spring Boot 2.0 is using Reactor Netty, which is using Netty's defaults (check out the EventLoopGroup documentation for that).

Spring Boot will soon allow you to customize that part (see #10418). In the meantime, you can provide your own ReactiveWebServerFactory bean and change that through the HttpServer configuration options (see this comment).

Sign up to request clarification or add additional context in comments.

1 Comment

Currently I see reactor-http-nio-1 in the logs, I use SpringBoot 2.0.0 M6. How can I configure netty to use all cores?
8

Currently, it seems that Spring Webflux 2.0 does not provide the ability to control threads.

Spring Webflux 2.0 is using Reactor-Netty. And ReactorNettyclass provides some configurations.

  • reactor.netty.ioWorkerCount
  • reactor.netty.ioSelectCount
  • reactor.netty.pool.maxConnections
  • etc

So, You can use it like this.

System.setProperty("reactor.netty.ioWorkerCount", "100");

I hope that Spring Boot will provide a custom configuration.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.