Tuesday 10 July 2012

Tomcat startup takes extra 3 minutes. Why?

I have faced a problem of long startup of tomcat 7 that used jvm 7 on the linux server. Tomcat without any application started over 3 minutes. In the catalina.out log there was a message:
May 22, 2012 10:02:48 AM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation
using [SHA1PRNG] took [131,611] milliseconds.
This problem appears due to Tomcat 7+ usage of SecureRandom class to provide random values for its session ids. You can use non-blocking setup, just set the following system property: -Djava.security.egd=file:/dev/./urandom
You can read more on this subject in tomcat wiki: http://wiki.apache.org/tomcat/HowTo/FasterStartUp

No comments: