[英]Tomcat 9 slow response
I have a web application(jsp) which was running fine on Tomcat 8.0.46 for more than a year.我有一个 Web 应用程序 (jsp),它在 Tomcat 8.0.46 上运行良好超过一年。 Few weeks back we upgraded to Tomcat 9.0.10, after couple of days of upgrade tomcat is responding with a delay of 8-16 seconds for some of the request.
几周前我们升级到 Tomcat 9.0.10,经过几天的升级后,tomcat 对某些请求的响应延迟了 8-16 秒。
I saw more than 800 request/sec in localhostaccess log, so I increased maxThreads to 512 as below and max heap memory to 4096MB.我在 localhostaccess 日志中看到超过 800 个请求/秒,所以我将 maxThreads 增加到 512,如下所示,最大堆内存增加到 4096MB。
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="512" minSpareThreads="4"/>
<Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
But the issue was not resolved, so I compared all the configuration with old Tomcat and found that tomcat9 is using tomcat executor where old was not using it.但是问题并没有解决,所以我将所有配置与旧的Tomcat进行了比较,发现tomcat9正在使用旧的未使用的tomcat执行器。 will executor impact request handling time?
执行者会影响请求处理时间吗?
Old tomcat configuration旧的tomcat配置
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
FYI the webapp consist of only jsps and few of them used to interact with DB using DBCP and gives XML response.仅供参考,webapp 仅包含 jsps,其中很少有用于使用 DBCP 与 DB 交互并提供 XML 响应。
I am not suspecting DB connection pool because it was already used and no change.我不怀疑数据库连接池,因为它已经被使用并且没有变化。
CPU : Xenon
RAM: 8GB
OS : Window 2012 server
JDK : jdk1.8.0_144
Added response time duration to localhost access log, can see the delay in some request, but the request prior and after are having quick response withing 15 milliseconds(bold).在本地主机访问日志中添加了响应持续时间,可以看到某些请求的延迟,但是之前和之后的请求在 15 毫秒(粗体)内都有快速响应。
10.50.29.27 - - [17/Dec/2018:09:27:23 -0500] "GET /App1/sendevent.jsp?TNAME=Transfer1 HTTP/1.1" 200 90 270BA450469B7AA71D22252711CA288A **0.015** http-nio-8080-exec-3
10.50.29.26 - - [17/Dec/2018:09:27:23 -0500] "GET /App1/Start.jsp?ACTION=START&ID=3154583920&SID=$num$&SESSIONID=63AA673E-B6EF-447E-AAB9-3B5B7260EB03&ScriptID=$sid$&ScriptData=$scriptdata$ HTTP/1.1" 200 2948 D97741884AD1005359430A3307D5D44E **6.031** http-nio-8080-exec-5
10.50.29.27 - - [17/Dec/2018:09:27:23 -0500] "GET /App1/sendevent.jsp?TNAME=Transfer1&TRANSFER_RESULT=S&LAST_ACTION=1&TRANSFER_REASON=connection.disconnect.transfer&TRANSFER_NOTE=undefined HTTP/1.1" 200 90 270BA450469B7AA71D22252711CA288A **0.000** http-nio-8080-exec-9
acceptorThreadCount=2
solved productivity problems for me in two cases: acceptorThreadCount=2
在两种情况下为我解决了生产力问题:
The third case when I saw the sufficiently better productivity is:当我看到足够好的生产力时的第三种情况是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.