Tomcat调优之记

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

使用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 p
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值