Slow start-up times for jetty and the lack of entropy

The Google App Engine offers a maven project that uses jetty to launch a local test server. This is convenient and works quite well, but jetty suffers from one problem when running in a virtual machine: It needs a full entropy pool to start-up (probably to generate encryption keys?). The problem is that virtual machines (especially server-only machines) fill their entropy pool slowly (because they have no input from keystrokes etc.).
This means that jetty will start-up immediately after booting the VM and will subsequently take longer and longer to start (I had to wait up to 5 minutes to start the VM). This is of course horrible when you tweak your source code and just want to “quickly” test your changes.

A simple solution is to fake the entropy with rng-tools (as suggested there: [1] and [2]). Just apt-get install rng-tools, edit /etc/default/rng-tools by adding a line that says HRNGDEVICE=/dev/urandom and start rng-tools with /etc/init.d/rng-tools start.

This will make jetty start almost instantly.

Please note, that this hack fix compromises your system’s security. Do not generate any encryption keys on that machine. This should only be done on development virtual machines and never on production systems.

Comments are closed.