Tomcat 7+嚴重依賴SecureRandom這個類爲它的session id或其它地方取得隨機數值,這取決於你的JRE,它有可能在tomcat啓動時形成很是大的耗時,好比,在子猴啓動tomcat-7.0.26的時候,它耗時近25秒! java
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [24,790] milliseconds.
要解決這個問題,能夠經過配置JRE使用非阻塞的Entropy Source,在bin/catalina.sh中加入這麼一行:-Djava.security.egd=file:/dev/./urandom 便可。 apache
加入後我再啓動tomcat,整個啓動降低到僅耗時Server startup in 912 ms. tomcat
參見:http://wiki.apache.org/tomcat/HowTo/FasterStartUp session