欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Windows10上优化Tomcat9速度

程序员文章站 2022-03-07 15:15:48
...

一、环境

OS:windows10

CPU:I7-6700HQ

内存:16G

JDK:1.11

Tomcat:9.0

 

 二、JVM参数优化

######catalina.bat#####增加以下参数设置

 

set "CATALINA_OPTS= -Xmx1024m -Xms512m -Xss256k -XX:InitiatingHeapOccupancyPercent=60 -server "

 

三、tomcat参数优化

#########server.xml#######修改

Excutor设置

<Executor 
    name="tomcatThreadPool" 
    namePrefix="catalina-exec-"
    maxThreads="1000" 
    minSpareThreads="100" 
    prestartminSpareThreads = "true"
    maxQueueSize = "100"
/>

 

Connector设置

<Connector
 executor="tomcatThreadPool"
 port="8080"
 protocol="org.apache.coyote.http11.Http11Nio2Protocol"
 connectionTimeout="60000"
 maxConnections="10000"
 redirectPort="8443"
 enableLookups="false"
 acceptCount="1000"
 maxPostSize="10485760"
 maxHttpHeaderSize="8192"
 compression="on"
 disableUploadTimeout="true"
 compressionMinSize="2048"
 acceptorThreadCount="2"
 compressableMimeType="text/html,text/plain,text/css,application/javascript,application/json,application/x-font-ttf,application/x-font-otf,image/svg+xml,image/jpeg,image/png,image/gif,audio/mpeg,video/mp4"
 URIEncoding="utf-8"
 processorCache="20000"
 tcpNoDelay="true"
 />

 

关闭acess log

		<!--	 
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
         -->

 

四、单tomcat上最简单JSP性能

最大:6000QPS

平均:4000QPS

 

 

相关标签: tomcat