AgentScape startup is slow

When AgentScape starts, it uses the java.security.SecureRandom class to generate some random data. This relies on system entropy to be seeded.

Entropy data can be gathered in various ways (disk/network access, keyboard/mouse movements). If startup is lagging, it may help to move the mouse a little bit to create some more entropy. However, on servers this is not always possible. In this case (or in any other case) you have to make sure that the random source is properly configured.

For ubuntu (or other linux variants) intialization of the SecureRandom may be done using data from /dev/random. This may be slow if the random device is low on entropy. You can configure to use /dev/urandom (unblocking random) or a hardware random generator instead.

Urandom is less secure because it reuses some of the entropy data from the actual random device. However, the difference in initialization times can be dramatic. For example, it may take up to 30 seconds to get enough data from /dev/random, while it would take only a few milliseconds for urandom.

JVM argument

For java, you can specify which EGD (entropy gather daemon) you want to use by supplying a JVM argument.

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

system-wide random settings

In ubuntu, system-wide urandom settings can be configured by installing rng-tools package, and configuring it to use /dev/urandom as randomness source. You will need super user privileges to install these tools.

sudo apt-get install rng-tools

If this fails to start, edit the file /etc/default/rng-tools and make make sure it contains a line

HRNGDEVICE=/dev/urandom

Restart the service

sudo service rng-tools restart
faq.txt · Last modified: 2010/04/28 13:26 by reinier