我们都知道,SpringBoot默认的内嵌容器是Tomcat,也就是我们的程序实际上是运行在Tomcat里的。所以与其说SpringBoot可以处理多少请求,到不如说Tomcat可以处理多少请求。
关于Tomcat的默认配置,都在spring-configuration-metadata.json文件中,对应的配置类则是org.springframework.boot.autoconfigure.web.ServerProperties。
线程池4大参数
可以关注下线程池的常用4大参数:
{
"name": "server.tomcat.threads.min-spare",
"type": "java.lang.Integer",
"description": "Minimum amount of worker threads.",
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties$Tomcat$Threads",
"defaultValue": 10
},
{
"name": "server.tomcat.max-threads",
"type": "java.lang.Integer",
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProp

本文探讨了SpringBoot内置Tomcat处理请求的能力,重点分析了线程池的四大参数:最小工作线程数、最大工作线程数、最大连接数和等待队列长度。讲解了它们如何影响服务性能,并提供了配置建议,以提高服务效率。
最低0.47元/天 解锁文章
6739

被折叠的 条评论
为什么被折叠?



