Over a million developers have joined DZone.

Release Engineering & Parallel Deployment

DZone 's Guide to

Release Engineering & Parallel Deployment

· DevOps Zone ·
Free Resource

“Tomcat” is always considered as a “poor-man’s server”, but the Tomcat 7 has something really interesting to offer i.e.Parallel Deployment.This was contributed by SpringSource (now VMware).Parallel Deployment is an approach that allows several online deployment operations to run simultaneously or in simple words it is the ability to deploy more than one version of your web application in parallel, making all versions available under the exact same URL. The parallel deployment also helps in the patch releases and advocating the best version of the application based on the performance and traffic

The most exciting thing with this feature is “Zero Down-Time Release (deployment and rollback) Process”. Whenever we go for a deployment process, we shutdown the server, remove all active connections, drain out the older version and move or fire the updated version of the application. Considering from a real-time project scenario, the developer does not have to get approval from his manager and the manager does not have to get necessary approvals from the customer – as there is no downtime impact involved. So, the developer himself can push the latest code and test/monitor the application with the live users.

If, we can co-relate this with the approach, Facebook, Flickr, Google and many other companies have been following where the developer directly pushes the code to production and shepards it until any unforeseen issue is reported by the user. As a quick statistics, Facebook developers push the code to production “daily twice” with millions lines of code five days a week. Similarly Flickr pushes 10 deploys per day (full article - slideshare)

One of the finest videos explaining the Release Engineering at Facebook – Click Here

 Here is a simple usecase for testing with multiple variants of the application :

Scenarios :

  • Push three different versions of a Hello World program V001, V002 and V003, one after the other and then monitoring the static application URL that keeps changing as and when the updated version is deployed/rolled-out
  • UnDeploy a couple of versions (the case of application rollback) to see, how the application responds.

Pictorial representation of the scenario:


Steps :

  • Create a simple Index.html as represented below (the versions shows the changes that needs to be incorporated with multiple version releases)


  • Create a Build.xml as shown below, the undeploy target is used during rollback. During the deploy step execution a new Version of WAR file is created “PDRelease##001” and is copied to the Tomcat/webapps folder. For multiple release versions the Count is increased. The general approach for creating a new versioned WAR file is to have the format <ApplicationName>##< Version Number>.war:
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <project name="Testing the Parallel Deployment Process" basedir=".">
  3. <property name="warfile" value="PDRelease##001"/>
  4. <target name="unpack">
  5. <unwar src="${warfile}.war" dest="${warfile}" />
  6. </target>
  7. <target name="create">
  8. <war destfile="${warfile}.war" webxml="WEB-INF/web.xml" update="true">
  9. <fileset dir=".">
  10. <include name="index.html"/>
  11. </fileset>
  12. </war>
  13. </target>
  14. <target name="copy">
  15. <copy todir="E:\Test\ReleaseMgmt_Tomcat\webapps" overwrite="true">
  16. <fileset dir=".">
  17. <include name="*.war"/>
  18. </fileset>
  19. </copy>
  20. </target>
  21. <target name="undeploy">
  22. <delete dir="E:\Test\ReleaseMgmt_Tomcat\webapps\sanfran##004"/>
  23. <delete>
  24. <fileset dir="E:\Test\ReleaseMgmt_Tomcat\webapps">
  25. <include name=" PDRelease##002.war"/>    
  26. </fileset>
  27. </delete>
  28. </target>  
  29. <target name="deploy">
  30. <antcall target="create"/>
  31. <antcall target="copy"/>
  32. </target>
  33. </project>
  • After a successful execution of the build.xml,  the Portal is accessed :
    • Buildfile: C:\Users\user\workspace\ParallelDeployment\build.xml
    • create:
    •   [war] Building war: C:\Users\user\workspace\ParallelDeployment\PDRelease##001.war
    • copy:
    •   [copy] Copying 5 files to E:\Test\ReleaseMgmt_Tomcat\webapps
    • Total time: 1 second


  • Next, the changes in the index.html are incorporated and the new versions of WAR files are deployed to access the Portal. (for showcase – opened it in 3 different browsers). Otherwise it will always take the Highest Version of the Application. With each individual browser, the different versions of the applications can be accessed.


  • Quick snapshot of the webapps folder :


  • The Version V003 is un-deployed or rolled back , so that the Highest Version of the application available is PDRelease##002


  •  The Logs can be verified to understand the history, as to which Application version was deployed or un-deployed
  1. Nov 03, 2012 8:02:14 PM org.apache.catalina.startup.HostConfig deployWAR
  2. INFO: Deploying web application archive E:\Test\ReleaseMgmt_Tomcat\webapps\PDRelease##001.war
  3. Nov 03, 2012 8:02:14 PM org.apache.catalina.startup.HostConfig deployWAR
  4. INFO: Deploying web application archive E:\Test\ReleaseMgmt_Tomcat\webapps\PDRelease##002.war
  5. Nov 03, 2012 8:02:14 PM org.apache.catalina.startup.HostConfig deployWAR
  6. INFO: Deploying web application archive E:\Test\ReleaseMgmt_Tomcat\webapps\PDRelease##003.war
  7. Nov 03, 2012 8:02:15 PM org.apache.catalina.startup.HostConfig deployWAR
  8. Nov 03, 2012 8:10:00 PM org.apache.catalina.startup.HostConfig checkResources
  9. INFO: Undeploying context [/PDRelease##003]

Things to be taken care of :

  • Internal Cache should be written separately as multiple versions of the application will be accessing and going on/off. A perfect example to visualize this situation would be to updating the database based on a caching mechanism.
  • Logging (where does the logs get written for different versions of the application)
  • Session handling is currently taken care of by Tomcat. So any changes to the Session handling configurations will affect the parallel deployment approach.
  • Only one listener can listen on any given port.
  • From an enterprise application perspective, there might be a situation wherein multiple versions of the app, will be accessing a common file store of database row. So how do we handle the locking mechanism for a smooth and hassle free access.
  • Rolling back of changed schemas, data entry row updates in the database, webservice configuration changes

Best Practice:

  • As a best practice, the version numbers for the WAR files can be numbered in sync with the CVS or SVN version of the application in the repository. So, the war file name can be mentioned as  <ApplicationName>##<SVN or CVS Version Number>.war
  • Strategize and draft a schedule for the deployment approach when and under what condition the code needs to be pushed or rollback

Parallel Deployment is not suited for cases like :

  • Dealing with web-applications requiring in-memory caching would be challenging as the cache will have the stale information and will not serve the purpose.
  • Web applications which require, offline deployment and restart or server–in that case parallel deployment approach is not a best fit.

Advantages of Parallel Deployment or Phased Release Engineering:

  • Speed and Scale of deployment
  • Easy deployment and rollback – facilitating continuity of business without any show-stopper with issues related to the new deployment. The last best version can always be rolled back.
  • A/B or split testing
  • Better end user testing – pushing the code to production or any higher environment is always a nail-biting situation. With parallel deployment and patch release approach the code can be silently pushed to production and get it tested with the end-user.
  • Provides a better ground for experimentation and deploy without any fear.
  • A cushion for the developers and the customers with incremental releases.
  • A developer can act as a release engineer and vice-versa.
  • The developer shepard’s his change to the world

Other Tools to explore:

There are many other tools which the companies like Facebook and Google use  pushing the code on an incremental and decremental fashion - ‘need to explore to figure out how exactly it is done using the tools. Couple of other tools 'came across are

  • BOSH  (developed by the CloudFoundry - VMWARE team and now opensourced)
  • Capistrano (another OSS).
  • Asgard (OSS) – also provides an application deployment and version rollback feature on Amazon EC2 instance


PN : Please do keep posting your valuable comments and suggestions on the same and feel free to correct me if my understanding is wrong.

Happy Learning :-)


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}