Tomcat – Hot deployment in production of J2EE Web Application

apache-2.2javajettytomcat

How do I deploy my Java WAR file on a production server without any downtime. I currently use Apache2 -> Jetty6 when I need to update the web application I unzip the war into the directory then restart the Jetty Service

/etc/init.d/jetty6 restart

This can take 5 minutes to restart is there another way? How do "big" websites do it?

In my experience hot deployment such as JBoss fails because the Garbage Collector doesn't collect everything and the service/process runs out of memory of has the situation improved?

Best Answer

How about this. Create a script that does the following:

  • Start a second instance of jetty on port 8081.
  • Reload alternate apache configuration to send you traffic to 8081. I think this step should be fast. I use nginx which is instantaneous.
  • Kill 8080 jetty
  • Copy updated war into 8080 jetty webapps folder
  • Restart jetty on port 8080
  • Point apache back to 8080
  • kill jetty on 8081