Tomcat startup project is slow

There are many reasons. There are three situations I encountered that may cause the tomcat startup project to slow down

Case 1: Tomcat will check jars during startup. When a large number of jars are detected, it will take a long time to start

Solution: change this line in the catalina.properties file

    tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\

Modify to tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*.jar

Situation 2: The project started successfully, but it took a long time

 The time is long enough for you to doubt your life. My project is springboot. The meaning of springmvc project is the same. My springboot project is stuck in this line.

 At first I thought it was my project that there was no problem. After investigating for a long time, it took about ten minutes during the investigation process, but suddenly it continued to start.

 Only then did I realize that it was not a code problem, it must be a problem with certain settings. Before optimization, my startup time was terribly long.

It is this thing that is causing trouble. After searching for information, I found that it was caused by "entropy random". The org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom class generates an instance of the secure random class SecureRandom as the session ID.

solution

Solution 1 : Add this line in catalina.sh: -Djava.security.egd=file:/dev/urandom

Solution 2 : Solve in JVM environment

The file jre/lib/security/java.security under jre in your jdk installation path

securerandom.source=file:/dev/random is modified to

securerandom.source=file:/dev/urandom

Guess you like

Origin blog.csdn.net/ClearLoveQ/article/details/105578469