Score:0

Tomcat Deployment Slow on Unix Server

cn flag

We recently moved to Tomcat from WebSphere for our application.

We are using: JDK 1.8 Build 191 and Tomcat 9.0.50. Most of the application is a mix Servlet/JSP and a few webapps with Spring MVC, it does use some multithreading

Now our test servers deploy absolutely fine. Its pretty zippy. But when deploying on Tomcat on Production, it just comes to a screeching halt.

For Example, This is an output from the Test Server:

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

And this is the same webapp on Production:

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

I have this set on setenv.sh file:

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"

And I have configured my server.xml with:

<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" />

And the Engine tag like:

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

Not to mention, the app runs very slow on it too! The page load times are gone up by about 200-300% now compared to when it ran on WebSphere. Am I missing something here? Some help on this would be really appreciated. Thanks!

cn flag
Also if someone can shed some light on NIO and NIO2. If switching to NIO2 would improve the performance a bit.
Michael Hampton avatar
cz flag
In one case you are deploying a WAR file and in the other (lengthy case) you are deploying from a directory. Why the difference?
cn flag
@MichaelHampton Both the cases, I am deploying a WAR. The logs are from server startup. The WAR files are already present in Tomcat's webapp directory. The difference, I wish I could tell you what the reason is! The production Unix machines are far beefier than the test ones.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.