Tomcat 性能调优 [英] Tomcat performance tuning

查看:18
本文介绍了Tomcat 性能调优的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调优Tomcat 7的性能,服务器配备24核32GB内存,我的测试界面是一个没有任何进程的RESTful服务(立即响应),server.xml的配置如下...

I am tuning the performance of Tomcat 7, the server is equipped with 24 cores and 32 GB memory, my testing interface is a RESTful service without any process(response immediately) and the configuration of server.xml is as following...

<Connector port="8088" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443"
           enableLookups="false"
           compression="off"
           maxConnections="8192"
           maxThreads="1000"
           tcpNoDelay="true"/>

和JVM配置...

-Xms8192M -Xmx16384M.

JMeter 的主机是另一台与上述服务器规格相同的计算机.而JMeter堆的配置是-Xms12218m -Xmx24426m.

The host of JMeter is another computer has same specification with above server. And the configuration of JMeter heap is -Xms12218m -Xmx24426m.

我的 JMeter 测试计划是一次并发向 RESTful 接口发送 240 个请求,但我注意到,前 100 个的平均响应时间不超过 50 毫秒,但在接下来的 100 个中增加到 1 秒,并且剩下的 3 秒.

My JMeter test plan is 240 requests send to the RESTful interface concurrently for once, but I have noticed that, the average of response time for the first 100 is no more than 50ms but it increases to 1 sec in the next 100 and to 3 sec for the rest.

我对这种现象很好奇,是不是配置有错误或者有什么建议?

I am curious about such phenomenon, is there any mistakes in the configurations or any suggestions?

提前致谢.

推荐答案

您可以配置:

acceptCount="2048"

maxConnections="1024"

maxConnections 和 maxThreads 有关系,你应该根据你的业务和 CPU 的核心数来配置 maxThreads,比如 8X 或 16X.acceptCount 是等待的连接数.

The maxConnections has relationship with maxThreads, and you should configure the maxThreads match your business and CPU's core number, such as 8X, or 16X. the acceptCount is the waiting connection number.

请注意,maxConnections 和 maxThreads 并不是越大越好,取决于您的服务器硬件的性能.

Note that the maxConnections and maxThreads is not the bigger the better, with the performance of your Server Hardware.

这篇关于Tomcat 性能调优的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆