tomcat启动慢, Creation of SecureRandom instance for session ID generation using [SHA1PRNG]took [xx] mil
来源:互联网 发布:ipad苹果园软件下载 编辑:程序博客网 时间:2024/06/16 16:20
通常情况下,tomcat启动只要7-8秒钟,突然有一天,tomcat启动非常慢,要花5~6分钟,甚至更久,以下是解决方案
SHA1PRNG算法是基于SHA-1算法实现且保密性较强的伪随机数生成器。
在SHA1PRNG中,有一个种子产生器,它根据配置执行各种操作。
1)如果Java.security.egd属性或securerandom.source属性指定的是”file:/dev/random”或”file:/dev/urandom”,那么JVM会使用本地种子产生器NativeSeedGenerator,它会调用super()方法,即调用SeedGenerator.URLSeedGenerator(/dev/random)方法进行初始化。
2)如果java.security.egd属性或securerandom.source属性指定的是其它已存在的URL,那么会调用SeedGenerator.URLSeedGenerator(url)方法进行初始化。
这就是为什么我们设置值为”file:///dev/urandom”或者值为”file:/./dev/random”都会起作用的原因。
在这个实现中,产生器会评估熵池(entropy pool)中的噪声数量。随机数是从熵池中进行创建的。当读操作时,/dev/random设备会只返回熵池中噪声的随机字节。/dev/random非常适合那些需要非常高质量随机性的场景,比如一次性的支付或生成密钥的场景。
当熵池为空时,来自/dev/random的读操作将被阻塞,直到熵池收集到足够的环境噪声数据。这么做的目的是成为一个密码安全的伪随机数发生器,熵池要有尽可能大的输出。对于生成高质量的加密密钥或者是需要长期保护的场景,一定要这么做。
那么什么是环境噪声?
随机数产生器会手机来自设备驱动器和其它源的环境噪声数据,并放入熵池中。产生器会评估熵池中的噪声数据的数量。当熵池为空时,这个噪声数据的收集是比较花时间的。这就意味着,Tomcat在生产环境中使用熵池时,会被阻塞较长的时间。
解决
有两种解决办法:
1)在Tomcat环境中解决
可以通过配置JRE使用非阻塞的Entropy Source。
在catalina.sh中加入这么一行:-Djava.security.egd=file:/dev/./urandom 即可。
加入后再启动Tomcat,整个启动耗时下降到Server startup in 2912 ms。
2)在JVM环境中解决
打开$JAVA_PATH/jre/lib/security/java.security这个文件,找到下面的内容:
securerandom.source=file:/dev/urandom
替换成
securerandom.source=file:/dev/./urandom
----------------------------------------------------------------------------------------------------------------------------------------
如果您认为本教程质量不错,读后觉得收获很大,预期工资能蹭蹭蹭的往上涨,那么不妨小额赞助我一下,让我有动力继续写出高质量的教程。-------------------------------------------------------------------------------------------------------------------------------
- tomcat启动慢, Creation of SecureRandom instance for session ID generation using [SHA1PRNG]took [xx] mil
- tomcat 启动慢 Creation of SecureRandom instance for session ID generation using [SHA1PRNG]took [xx] mil
- tomcat启动慢, Creation of SecureRandom instance for session ID generation using [SHA1PRNG]took [xx] mil
- Creation of SecureRandom instance for session ID generation using [SHA1PRNG]took [xx] milliseconds
- tomcat 启动慢 Creation of SecureRandom instance for session ID generation using [SHA1PRNG]
- Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [184,726] millisec
- Tomcat启动 Creation of SecureRandom instance for session ID
- Tomcat启动时Creation of SecureRandom instance for session ID很慢
- tomcat启动太慢,耗时很长的问题 Creation of SecureRandom instance for ...
- Tomcat启动缓慢 Creation of SecureRandom instance for ... 花费时间过长的解决方法
- 关于SecureRandom导致tomcat启动慢
- SpringBoot启动慢--SecureRandom
- secureRandom 实现 之 SHA1PRNG
- Tomcat启动时SecureRandom超级慢的问题
- Tomcat启动时SecureRandom超级慢的问题
- Tomcat启动时SecureRandom超级慢的问题
- Tomcat启动时SecureRandom超级慢的问题
- SecureRandom生成随机数超慢 导致tomcat启动时间过长的解决办法
- oracle中integer、pls_integer和number类型
- C语言第六章重要知识总结
- 双线性插值原理与实现
- 基于 mesos 的容器调度框架
- 微信小程序踩坑——Android真机调试问题
- tomcat启动慢, Creation of SecureRandom instance for session ID generation using [SHA1PRNG]took [xx] mil
- JavaIO与异常基础
- LeetCode.561 Array Partition I
- 暂时解决 Android-Studio 编译耗时(好久、太长)问题
- bzoj 2818 GCD(欧拉函数)
- 计算机网络学习笔记2
- Android:使用ListView显示信息列表
- 输入过滤筛选下拉信息(类似百度输入)
- 第八周【项目3-顺序串算法】