Tomcat 8速度会随着时间降低 [英] Tomcat 8 speed gets degraded over time
问题描述
我正在使用 Tomcat 8.5 托管用于Java REST服务的WAR.
I am using Tomcat 8.5 to host a WAR which is used for java REST services.
在我的REST服务中,我创建一个连接并从用户那里获取一个多部分表单数据文件,使用扫描引擎对其进行扫描并返回结果.刚开始时,tomcat运行良好,速度接近57-58 Mbps,但随着时间的推移会降级(在5-8分钟内降为近一半)
In my rest service, I create a connection and take a multi-part form data file from user, scan it using a scan engine and return the result. At the start, tomcat is running fine and giving a speed of almost 57-58 Mbps but degrades over time (degrades to nearly half in 5-8 min)
我的setenv.bat
文件如下所示.
"set "JAVA_OPTS=%JAVA_OPTS% -Xms1024m -Xmx5120m -XX:MaxMetaspaceSize=512m -Xincgc -server""
JVM
使用ParNewGC
进行垃圾收集.
我的server.xml
文件看起来像这样
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="100" minSpareThreads="8" maxSpareThreads="10" acceptorThreadCount="16" acceptCount="500"/>
<!--acceptCount :The maximum queue length for incoming connection requests when all possible request processing threads are in use. Any requests received when the queue is full will be refused. The default value is 100.
A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" socket.rxBufSize="10000000" socket.txBufSize="3000000" socket.directBuffer="true" />
<!-- A "Connector" using the shared thread pool-->
因为我的反应是完全动态的.我不使用任何类型的缓存.请帮助我解决这个问题.
As my response is completely dynamic. I am not using any type of caching. please help me with this issue.
推荐答案
由于大量的打开tcp/ip连接,这可能是错误的.尝试与服务器连接一次并发送数据当发现性能下降时,请检查套接字.
It may be a error due to a large number of open tcp/ip connections .Try connecting with server for once and send data check for sockets when you see a performance degradation.
在Windows中,您可以使用netstat-an
检查打开的插槽.
In windows, you can use netstat-an
to check the open sockets.
这篇关于Tomcat 8速度会随着时间降低的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!