如何加速Tomcat SSL init [英] How to speedup Tomcat SSL init

查看:114
本文介绍了如何加速Tomcat SSL init的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Tomcat webapp,需要能够重启Tomcat以加载代码更改。但是,有时Tomcat需要很长时间才能启动,因为主线程在以下位置停滞:

I am doing development of a Tomcat webapp and need to be able to restart Tomcat to load code changes. However, sometimes Tomcat takes a long time to startup as the main thread is stalled in the following place:

java.lang.Thread.State: RUNNABLE
    at org.apache.tomcat.jni.SSL.initialize(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.core.AprLifecycleListener.initializeSSL(AprLifecycleListener.java:214)
- locked <119e583> (a java.lang.Class)
at org.apache.catalina.core.AprLifecycleListener.lifecycleEvent(AprLifecycleListener.java:83)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:770)
at org.apache.catalina.startup.Catalina.load(Catalina.java:530)
at org.apache.catalina.startup.Catalina.load(Catalina.java:550)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:260)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)

此停顿是由可用的熵引起的(如运行cat / proc / sys / k所示) ernel / random / entropy_avail)太低了。

This stall is caused by the available entropy (as shown by running cat /proc/sys/kernel/random/entropy_avail) is too low.

当我开发代码时,我不关心SSL引擎是否用一个好的随机数初始化。

When I am developing code I don't care if the SSL engine is initialised with a good random number.

我有什么方法可以将一些假熵转储到/ dev / rnd或强制Tomcat使用一些假熵?

Is there any way for me to dump some fake entropy into /dev/rnd or force Tomcat to use some fake entropy?

我可以通过运行find /来更快地推高熵,但这需要一段时间来产生足够的熵。

I can push up the entropy more quickly by running "find /" but this takes a while to produce enough entropy.

推荐答案

将环境变量RANDFILE设置为/ dev / urandom会使Tomcat将此源用于SSL init。

Setting the environment variable RANDFILE to "/dev/urandom" makes Tomcat use this source for SSL init.

这篇关于如何加速Tomcat SSL init的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆