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

本文介绍了SpringBoot应用在启动时出现接口响应慢的问题,问题源于Tomcat依赖SecureRandom类生成随机数导致的熵源不足。解决方案包括在启动命令中添加-Djava.security.egd参数或修改java.security文件,将securerandom.source设置为/dev/./urandom,以避免因熵池不足造成的阻塞。同时,文章解释了/dev/random与/dev/urandom的区别,强调了熵池在安全性与效率之间的平衡。
摘要由CSDN通过智能技术生成

之前允许都正常的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类来生

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值