Tomcat启动很慢如何解决(亲测有效)

Tomcat启动很慢如何解决(亲测有效)

经验文章nimo972025-01-11 14:42:3713A+A-

tomcat启动耗时67067ms折合67秒,刚刚安装的干净tomcat,显然不对劲。

有一条日志引起了我的注意:

11-Sep-2017 12:20:34.870 WARNING [main] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [66,193] milliseconds.

显然tomcat执行到这里时出问题了,google了一下:"tomcat startup take long time SecureRandom",经过搜索,发现了一个解决方法

Slow startup on Tomcat 7.0.57 because of SecureRandom

问题缘由:当没有足够的entropy反馈给/dev/random时调用securerandom的时候可能引起阻塞。

解决方法:

vi /usr/java/jdk1.8.0_251-amd64/jre/lib/security/java.security

securerandom.source=file:/dev/./urandom

更新后重启tomcat

点击这里复制本文地址 以上内容由nimo97整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!
qrcode

尼墨宝库 © All Rights Reserved.  蜀ICP备2024111239号-7