Java 关于SpringBoot Tomcat acceptCount池
我正在处理springboot上的Tomcat配置 让我们假设我有以下配置:Java 关于SpringBoot Tomcat acceptCount池,java,spring,spring-boot,tomcat,configuration,Java,Spring,Spring Boot,Tomcat,Configuration,我正在处理springboot上的Tomcat配置 让我们假设我有以下配置: server: tomcat: min-spare-threads: ${min-tomcat-threads:20} max-threads: ${max-tomcat-threads:20} accept-count: ${accept-concurrent-queue:1} max-connections: ${max-tomcat-connections:100} 我有一个
server:
tomcat:
min-spare-threads: ${min-tomcat-threads:20}
max-threads: ${max-tomcat-threads:20}
accept-count: ${accept-concurrent-queue:1}
max-connections: ${max-tomcat-connections:100}
我有一个简单的RestController,代码如下:
public String request(@Valid @RequestBody Info info) {
log.info("Thread sleeping");
Thread.sleep(8000);
return "OK";
}
然后我做了以下测试:
server:
tomcat:
min-spare-threads: ${min-tomcat-threads:20}
max-threads: ${max-tomcat-threads:20}
accept-count: ${accept-concurrent-queue:0}
max-connections: ${max-tomcat-connections:100}
但是这个“0”被完全忽略了(我认为在这个例子中它的意思是“无限”)。
所以,我的问题是:
?如果达到最大连接数限制,是否可以将Tomcat配置为不排队操作?
或许
?是否可以将Tomcat配置为拒绝任何排队的操作
事先非常感谢
致以最诚挚的问候。该参数的值直接传递给操作系统:例如,对于UNIX es,它被传递给listen
。由于传入连接总是在JVM接受它之前放入OS队列,因此低于1
的值没有意义。Tomcat显式忽略这些值,并保留其默认值100
但是,Tomcat中真正的队列是从OS队列接受的连接,但由于缺少处理线程(maxThreads
)而未被处理。您最多可以有maxConnections-maxThreads+1
这样的连接。在您的情况下,有81个连接等待处理