Pages

Thursday, August 8, 2013

Tomcat 7 : Parallel Deployment

One of the Main problem of Working with Web applications in Tomcat is Outage of the application. When we have an application already running and when we need to deploy a new version , The typical operation is to cut users off from the application , stop the running application, un-deploy the current version, deploy a new version, start the new version, and finally allow users to return to the application.

Even though the deployment goes fast , still there will be a interruption of the Application.

The Apache Tomcat v7 brings with it a feature called Parallel Deployment, which allows deploying more than one application to the same context. This feature allows any activities going on with a session-based application to continue interacting with the “old” version even as a new version is deployed. This results in an effective zero-downtime solution, as long as your application behaves.

The key to getting Tomcat to recognize a parallel deployment is by identifying the version of the WAR or directory containing the application. So if we create application with the Name ParallelDeployment7.war and deploy it. Once we are sure that the app is working fine, we then change the name of the ParallelDeployment7.war to ParallelDeployment7##001.war and then deploy again.

Tomcat 7 Manager console now provides a new column which says version which shows the below

 We can see that ParallelDeployment7 has a Version running as 001. So we have 2 versions of the applications runnings.

We will see how the parallel Deployment in Tomcat 7 works when Sessions are Involved in the Next Article.

Note: Previous Versions of the applications are not automatically removed . You will have to remove them yourself using the manager application when their session count drops to zero or you just can't wait anymore.

So Happy learning , More To Come :-)