Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Connectors are slow to startup

The HashSessionIdManager class by default will use the java.security.SecureRandom random number generator. It uses the operating system's source to provide entropy. If your machine is very tranquil, then there may not be enough entropy to drive the random number generator and hence the operating system waits for more interrupts, disk IO, network traffic or whatever is used to generate the entropy.

An INSECURE solution, apart from loading the machine more (smile), is to replace the SecureRandom with the java.util.Random generator instead. Add the following lines to your jetty.xml file:

Code Block
xml
xml
<Set name="sessionIdManager">
  <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
    <Arg>
      <New class="java.util.Random"/>
    </Arg>
    <Set name="workerName">node1</Set>
  </New>
</Set>

Session IDs generated by Random may be able to be predicted, thus it is not recommended to use Random in production.

For more information, here are the relevant Sun bug numbers: 6202721, 6521844, 5031872.

Note that one of the workarounds suggested is to try and force the use of the /dev/urandom device, which does NOT block, rather than the /dev/random device which does:

Code Block
Set the system property: -Djava.security.egd=file:/dev/urandom 
Make sure that the java.security file contains this setting:
  securerandom.source=file:/dev/urandom

NB Some workaround reports use /dev/./urandom instead of /dev/urandom.

Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery