2

When starting up a Tomcat web app, the creation of SecureRandom instance for session ID takes a long time (over 3 minutes).

What is the best way to speed it up?

Dec 20, 2014 9:09:16 AM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [210,579] milliseconds.

ServerInfo on Ubuntu 14.04:

Server version: Apache Tomcat/7.0.52 (Ubuntu)
Server built:   Jul 24 2014 08:38:51
Server number:  7.0.52.0
OS Name:        Linux
OS Version:     3.13.0-32-generic
Architecture:   amd64
JVM Version:    1.7.0_67-b01
JVM Vendor:     Oracle Corporation
Victor Lyuboslavsky
  • 9,882
  • 25
  • 87
  • 134
  • 3
    That can't be that /dev/random bug again, can it? Can you try and start the JVM with the `-Djava.security.egd=/dev/./urandom` option? NOTE THE DOT, it is important and should not be removed, `/dev/urandom` alone doesn't work – fge Dec 20 '14 at 16:59
  • Yes, that worked. And I no longer see the `SessionIdGenerator` message in `catalina.out` either. Not sure if that matters. – Victor Lyuboslavsky Dec 20 '14 at 17:16
  • Maybe this message only appears if the generator is slow? Well, anyway, I thought that bug was fixed in the latest JVMs but apparently not. – fge Dec 20 '14 at 17:19
  • @fge i think it is fixed in JDK 8 – sol4me Dec 20 '14 at 17:34
  • For some more workarounds, see http://stackoverflow.com/questions/137212/how-to-solve-performance-problem-with-java-securerandom – geert3 Dec 20 '14 at 20:58

0 Answers0