Spring Boot 2.0反应式Webflux配置中的默认线程数

问题描述:

在Spring Boot 2.0中使用Spring 5反应式Webflux时,用于处理请求的默认线程数是多少?如何配置使用的线程数?

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?

用于请求处理的默认线程数由基础Web服务器确定;默认线程数由基础Web服务器确定.默认情况下,Spring Boot 2.0使用的是Reactor Netty,后者使用的是Netty的默认值(请参阅EventLoopGroup文档).

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将很快允许您自定义该部分(请参见#10418 ).同时,您可以提供自己的ReactiveWebServerFactory bean并通过HttpServer配置选项进行更改(请参见

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).