views:

442

answers:

4

I have a Grails application, built to a war file (~30mb). When I attempt to deploy the war file on Tomcat 6 via the application manager, it takes upwards of 10 minutes to deploy, or hangs indefinitely. When it hangs I can restart Tomcat and the app is usually deployed, however sometimes I have to repeat the process. I've also noticed that during deployment, the Java process maxes out the CPU and the RAM is at ~10-15%.

I'm fairly new to Java, so I don't know if this is normal, but I can't imagine how it could be. Is there something I can do to make this run smoother/faster? Is there a better way to deploy than Tomcat's app manager?

A: 

Don't use application manager. My way is to upload it somewhere out of the webapps directory and then copy it to webapps directory. Takes a lot less of deplyoment time.

Trick
Will it not collide if application server starts loading your webapp before all files (relevant class per se) have been copied?
Maxim Veksler
I copy war file, not extracted files.
Trick
+1  A: 

Definitely check the Tomcat logs for any errors/warnings.

You probably have some expensive/sensitive code logic in one of the ServletContextListeners. They are usually initialized during startup. If so, then I would debug/profile it for any performance matters/leaks.

BalusC
A: 

I upload the WAR to my home directory, cd to /usr/local/tomcat, then run the following commands:

bin/shutdown.sh
rm webapps/ROOT.war
rm -rf webapps/ROOT
cp ~/ROOT.war webapps
bin/startup.sh
Kaleb Brasee
These seems to be the way to go. Deploying directly from the webapps folder only took a minute or two. Re: hot deployment, I found the system a little sluggish after a hot deployment, so the shutdown, deploy, startup strategy seems best. Thanks!
Thody
Another note on hot deployment, with 100% CPU usage, the live app is completely incapacitated anyway, so there's little benefit to keeping Tomcat online during the deployment.
Thody
+1  A: 

As noted I would copy the war to the webapps folder and let tomcat do the deployment, its also quicker saving you time.

Both Tomcat and Jetty will support a hot deploy. They simply monitor the deploy directory for changes, so you can just copy the .war file into that directory, and the server will undeploy/redeploy.

If using a remote server check the lag is not the time take to upload the war to a remote server over the network.

Karl