1. 程式人生 > >tomcat加載jjava程序非常慢解決

tomcat加載jjava程序非常慢解決

uri tom find local -name random 使用 cal lin


解決:

下面兩種方式都要添加上,速度會很快,啟動妙級的


1)在Tomcat環境中解決

可以通過配置JRE使用非阻塞的Entropy Source。

在catalina.sh中加入這麽一行:

JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"

即可。

加入後再啟動Tomcat,整個啟動耗時迅速下降。

2)在JVM環境中解決

find / -name java.security


打開$JAVA_PATH/jre/lib/security/java.security這個文件,找到下面的內容:

securerandom.source=file:/dev/urandom
替換成
securerandom.source=file:/dev/./urandom


實例:

[root@host-10-1-1-103 tomcat]# find / -name java.security
[root@host-10-1-1-103 bin]# find / -name java.security
/usr/local/jdk/jre/lib/security/java.security
/usr/local/jdk/jdk1.8.0_171/jre/lib/security/java.security


3、mysql數據看的max_connection 連接數調大即可解決調到1000

tomcat加載jjava程序非常慢解決