TomcatExpert

Parallel Deployment with Apache Tomcat 7

posted by mthomas on May 31, 2011 07:44 AM

Upgrading web applications can be very expensive if your storefront is the web. Weekend maintenance windows, or downtime in general can give an entire company heartburn. Survey data shows that web application downtime can cost some companies up to $72,000 per minute. Yet the cost of not constantly rolling out new features and bug fixes can equally penalize a company in the competitive online markets today.

Previously, to upgrade an application on Tomcat and avoid downtime, system administrators would have to set up multiple instances of Tomcat and do some very clever stuff with load balancers. This equals extra hardware costs as a permanent part of the company’s infrastructure.

Now with the advent of parallel deployment in Tomcat 7, you can have multiple versions of the same application installed at the same time on a single server. Users with active sessions can continue to use the old application and new users will be routed to the new version. This way, no user sessions will be interrupted, and the old application can gracefully phase out.

Setting Up Parallel Deployment

Parallel deployment is a function of the Context Container. The Context element represents a web application, which in turn specifies the context path to a particular Web Application Archive (WAR) file that is the application logic. Parallel deployment allows you to deploy multiple versions of a web application with the same context path concurrently. When choosing what version of the application for any given request, Tomcat will:

  1. Route new requests to the latest version, so new sessions go to the new application.
  2. If session information is in the request, check the session manager for a matching version, so existing sessions will go to the original application for the request.
  3. If session information is in the request, but the corresponding application is no longer present, it will route to the latest version.

Working Across Clusters

If you have clustered Tomcat, configured using the FarmWarDeployer, you can achieve parallel deployment within that cluster. The FarmWarDeployer is a component which lets you deploy a WAR file across an entire cluster. By placing the WAR file on the designated host, clustered Tomcat will automatically replicate that deployment across every server in the cluster.

Footnote

Because of the sophistication and cost savings this feature brings to enterprise deployments of Tomcat, this feature, built by VMware’s SpringSource, was initially looked at being part of VMware vFabric's tc Server, but once we got building it, it couldn’t be done cleanly without putting some hooks into Tomcat that didn’t fit naturally into the architecture. After careful consideration of what was best for Apache Tomcat, VMware decided to still fill the need to build this feature out, but donate it to the Apache Tomcat project at large.

Mark Thomas is a Senior Software Engineer for the SpringSource Division of VMware, Inc. (NYSE: VMW). Mark has been using and developing Tomcat for over six years. He first got involved in the development of Tomcat when he needed better control over the SSL configuration than was available at the time. After fixing that first bug, he started working his way through the remaining Tomcat bugs and is still going. Along the way Mark has become a Tomcat committer and PMC member, volunteered to be the Tomcat 4 & 7 release manager, created the Tomcat security pages, become a member of the ASF and joined the Apache Security Committee. He also helps maintain the ASF's Bugzilla instances. Mark has a MEng in Electronic and Electrical Engineering from the University of Birmingham, United Kingdom.

Comments

Parallel Deployment with Apache Tomcat 7

Are you saying that it is not available in open source version (Apace Tomcat 7.x)?

Parallel Deployment with Apache Tomcat 7

As per the title of the article, parallel deployment is a feature of Apache Tomcat 7. This may be confirmed by examining the changelog and/or reading the documentation.

koratm226, you can find how

koratm226, you can find how to do it on:

http://www.javacodegeeks.com/2011/06/zero-downtime-deployment-and-rollback.html

Mark, you probably have to add this information on tomcat documentation, it would be easier and quicker to know how to do it.

Anyway, it's an awesome feature! Congrats!

Nice

I did it manually from tomcat 5.5;
Let's see if it works ....
Great!

Fernando Franzini - Java Blog

Thank you for some other

Thank you for some other informative blog. Where else could I get that type of information written in such an ideal means.I’d be very thankful if you could elaborate a little bit further. Appreciate it!
power brake booster

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.