Tomcat啟動慢是什麼原因?
謝邀
apache官網有專門對這個問題的解釋並給出瞭解決方案,簡單來講是Java的一個bug
HowTo/FasterStartUp - Tomcat Wiki
Tomcat 7+ heavily relies on SecureRandom class to provide random values for its session ids and in other places。 Depending on your JRE it can cause delays during startup if entropy source that is used to initialize SecureRandom is short of entropy。 You will see warning in the logs when this happens, e。g。:
There is a way to configure JRE to use a non-blocking entropy source by setting the following system property:
-Djava.security.egd=file:/dev/./urandom
Note the “/。/” characters in the value。 They are needed to work around known
Oracle JRE bug #6202721
。 See also
JDK Enhancement Proposal 123
。 It is known that implementation of
SecureRandom
was improved in Java 8 onwards。
Also note that replacing the blocking entropy source (/dev/random) with a non-blocking one actually reduces security because you are getting less-random data。 If you have a problem generating entropy on your server (which is common), consider looking into entropy-generating hardware products such as “
EntropyKey
”。
————
注意不要丟掉
/dev/。/urandom
中的“/./”,因為jdk的bug,如果使用/dev/urandom實際還是使用的/dev/random
大兄弟你怕是沒有見過更慢的,電腦有的時候也是個問題
20秒的可以了,我們都要把elipse裡tomcat的45秒的啟動限制改成200秒。
不然有的專案偶爾就超了。。。
和電腦配置本身也有關係的,我剛剛試了一下我的,不放工程,單獨啟動的話只用519ms,而以前我的老筆記本都是1100ms以上
有電腦效能的問題,也有專案的問題