Question

Fresh Tomcat takes loong time to start up

  • Posted October 7, 2014

So I’m new to digitalOcean. I began with ubuntu server and ran an tomcat installation on it according to this tutorial

And server start up takes really long time (“INFO: Server startup in 518366 ms”). I have one app on it that only has index.html file in it, just for testing.

What could be the cause of this? Is the Lowest bugget option on digitalocean really that slow?

Subscribe
Share

+1. saved my time. i am using $5 plan.

apt-get install haveged

Try to install haveged - slow startup may occur when entropy pool runs dry.

Just wanted to update this thread if anyone comes across it. The solution was kind of hidden amongst comments and on a hard to find page:

**On the the JAVA_OPTS line, add the following: -Djava.security.egd=file:/dev/./urandom" **

Also - interestingly, after testing more with this, it seems that installing haveged (just apt-get install haveged with it’s default settings) does work as well. (without the additional line above).

(and using haveged is better for security due to the loss of true entropy on non-blocking /dev/urandom)

I am using $5 plan, too.

apt-get install haveged

does the trick. Thanks to @juriyfoboss

+1. thanks for this @juriyfoboss.

haveged worked for me like a charm.

apt-get install haveged

yeah, installing haveged did the trick, however, don’t get it why we need to install additional program to make it run fast )

I just spent several days thinking it was tomcat version, ubuntu version (had just upgraded), the firewall settings and the nginx proxy config I had fronting tomcat. I was trying to switch ports so after switching I thought I messed up the config somewhere but really it was just taking 10 mins to startup. DO this should really be part of the install instructions on setting up Tomcat with Ubuntu.

I almost spent the entire day looking for a solution .Thanks apt-get install haveged.

I’m getting about a 15 minute delay on both Tomcat install (fresh start) and even some service restarts. I’ve tried this even on larger droplet size (8GB RAM), not just the small size with the same issue.

Any progress or suggestions on this? (haveged did not work)

@juriyfoboss Could you also comment why would Tomcat need to use entropy pool on fresh intall?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Another way is changing the option directly on the file. Check this: Check this: http://stackoverflow.com/questions/26431922/tomcat7-starts-too-late-on-ubuntu-14-04-x64-digitalocean. This resolved my problem.

Modify JAVA_OPTS in catalina.sh to get this up quickly. It didn’t seem to take effect under /etc/default/tomcat7 for me. What is important is the java.security.egd line. (Update the library path as needed.)

JAVA_OPTS=“-Djava.library.path=/usr/local/apr/lib -Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx1024m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC”

Thank you very much for this. “Haveged” works!

Thank you. The “haveged” trick worked instantly!

“haveged” worked like charm… :D … Thanks a lot Is it a cheat code? ;)

+1 thank you very much “haveged” did the trick :)

How is it that it takes a full day to get Tomcat up and running and so long to find this answer? I found this on the third page of google search. It would behoove DO to be on top of these, especially with such a simple setup - Ubuntu + Tomcat if they want to be a player.

+1 to installing haveged. Thanks bro!

just installing haveged on Centos did not solve the issue, you have to start haveged service.