springboot接口慢_Springboot tomcat 启动慢 响应时间超长 问题解决

之前允许都正常的springboot jar,今天突然启动后反应非常慢,尤其是调用微信接口的方法,页面request一直处于pending状态。

经过长时间(5分钟)的等待后,日志打出下面warn:

o.a.c.util.SessionIdGeneratorBase : Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [170,241] milliseconds.

之前在ssm+tomcat里遇到过类似问题,今天第一次在springboot里遇到,搜了下网上也有各种解决方法,总结一下:

原因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.

意思是tomcat7以上的版本,在启动时会调用SecureRandom类来生

你可能感兴趣的:(springboot接口慢)