使用jmeter进行测试,
发现进程数到达一定的数量之后就不会在变化了。
[root@localhost ~]# pstree -p 3793 |wc -l
219
[root@localhost ~]# pstree -p 3793 |wc -l
219
[root@localhost ~]# pstree -p 3793 |wc -l
219
[root@localhost ~]# pstree -p 3793 |wc -l
查看spring-configuration-metadata.json文件,查看Tomcat的相关默认配置
{
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties$Tomcat",
"defaultValue": 100,
"name": "server.tomcat.accept-count",
"description": "Maximum queue length for incoming connection requests when all possible request processing threads are in use.",
"type": "java.lang.Integer"
},
{
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties$Tomcat$Accesslog",
"defaultValue": true,
"name": "server.tomcat.accesslog.buffered",
"description": "Whether to buffer output such that it is flushed only periodically.",
"type": "java.lang.Boolean"
},
{
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties$Tomcat$Accesslog",
"defaultValue": "logs",
"name": "server.tomcat.accesslog.directory",
"description": "Directory in which log files are created. Can be absolute or relative to the Tomcat base dir.",
"type": "java.lang.String"
},
{
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties$Tomcat$Accesslog",
"defaultValue": false,
"name": "server.tomcat.accesslog.enabled",
"description": "Enable access log.",
"type": "java.lang.Boolean"
},
{
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties$Tomcat$Accesslog",
"defaultValue": ".yyyy-MM-dd",
"name": "server.tomcat.accesslog.file-date-format",
"description": "Date format to place in the log file name.",
"type": "java.lang.String"
},
{
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties$Tomcat$Accesslog",
"defaultValue": "common",
"name": "server.tomcat.accesslog.pattern",
"description": "Format pa

本文通过jmeter测试发现,当进程数达到一定数量后,Tomcat不再接受新连接。研究了Tomcat的默认配置,重点关注了accept-count、max-connections、max-threads和min-spare-threads等参数。在调整了application.properties文件的配置后,服务重启并重新压测,并发支持从200+提升到800+,优化效果显著。同时,还提及了在Spring Boot内嵌Tomcat开发中,keepAliveTimeOut和maxKeepAliveRequests两个参数对性能的影响。
最低0.47元/天 解锁文章
4697

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



