Tomcat 在 Unix 服务器上部署缓慢

Tomcat 在 Unix 服务器上部署缓慢

我们最近将我们的应用程序从 WebSphere 迁移到了 Tomcat。

我们使用的是:JDK 1.8 Build 191 和 Tomcat 9.0.50。大多数应用程序是混合 Servlet/JSP 和一些带有 Spring MVC 的 Web 应用程序,它确实使用了一些多线程

现在我们的测试服务器部署得非常好。速度非常快。但是在生产环境中的 Tomcat 上部署时,速度就突然停止了。

例如,这是来自测试服务器的输出:

26-Aug-2021 08:56:11.585 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/app/tomcat/webapps/cdsrs.war]
26-Aug-2021 08:56:13.750 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
26-Aug-2021 08:56:14.091 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/app/tomcat/webapps/cdsrs.war] has finished in [2,505] ms

这是生产环境中的同一个 Web 应用程序:

26-Aug-2021 09:26:18.016 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/app/tomcat/webapps/cdsrs]
26-Aug-2021 09:26:19.870 INFO [Catalina-utility-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
26-Aug-2021 09:28:52.569 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/app/tomcat/webapps/cdsrs] has finished in [154,553] ms

我在 setenv.sh 文件上有此项设置:

export CATALINA_OPTS="$CATALINA_OPTS -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -Xloggc:gc/gc.log"
export CATALINA_OPTS="$CATALINA_OPTS -Xms3072M"
export CATALINA_OPTS="$CATALINA_OPTS -Xmx8192M"
export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=3072M"

我已经使用以下命令配置了我的 server.xml:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxHttpHeaderSize="65536" maxThreads="150" SSLEnabled="true" acceptorThreadCount="4" >
    <SSLHostConfig>
        <Certificate certificateKeystoreFile="conf/keystore.jks" certificateKeystorePassword="some_password" type="RSA" />
    </SSLHostConfig>
</Connector>
<Connector address="SERVER_HOSTNAME" port="8080" protocol="HTTP/1.1" maxHttpHeaderSize="65536" connectionTimeout="20000" redirectPort="8443" acceptorThreadCount="4" />

标签Engine如下:

<Engine name="Catalina" defaultHost="localhost" startStopThreads="0">

更不用说,应用程序在其上运行速度也很慢!与在 WebSphere 上运行时相比,现在页面加载时间增加了约 200-300%。我是否遗漏了什么?如果能提供一些帮助,我将不胜感激。谢谢!

相关内容