Tomcat啟動慢是什麼原因?馬面2019-03-02 17:12:41

謝邀

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。:

org。apache。catalina。util。SessionIdGenerator createSecureRandom INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [5172] milliseconds。

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

Tomcat啟動慢是什麼原因?知乎使用者2019-03-03 13:32:20

大兄弟你怕是沒有見過更慢的,電腦有的時候也是個問題

Tomcat啟動慢是什麼原因?風中的雪糕2019-03-03 22:48:55

20秒的可以了,我們都要把elipse裡tomcat的45秒的啟動限制改成200秒。

不然有的專案偶爾就超了。。。

Tomcat啟動慢是什麼原因?知來者之可追2019-03-04 12:55:26

和電腦配置本身也有關係的,我剛剛試了一下我的,不放工程,單獨啟動的話只用519ms,而以前我的老筆記本都是1100ms以上

Tomcat啟動慢是什麼原因?Icarus2019-03-10 11:21:04

有電腦效能的問題,也有專案的問題