tomcat manager |
During development of your application, you will need to deploy new versions 10's or 100's of times.
There are three ways to deploy a new application in Tomcat.
* Use the Tomcat Manager (shared or dedicated JVM)
* Use AutoDeploy (shared or dedicated JVM)
* Restart the entire JVM (dedicated JVM only)
At Metawerx, all our shared JVM's support Tomcat Manager and also AutoDeploy.
There is no reason to restart the JVM to restart your application.
Why do other hosts only provide Private JVM's?
Other hosting companies who support Java often don't supply these tools as they require detailed configuration changes. This leaves their customers with the following options: An expensive "private JVM" with a suitable RAM allocation, a cheap "private JVM" with very limited RAM, or a periodic-restart of Tomcat which brings down all websites on the Tomcat instance in order to reload new changes.
Tomcat Manager and AutoDeploy have been a part of Tomcat since Tomcat 4.0 and allows you to easily deploy, reload or undeploy your application(s).
Tomcat uses a separate ClassLoader per application, so it is quite a trivial task for Java or Tomcat to simply drop the current ClassLoader and instantiate a new one with your new application.
There are certain cases where this is not usable. Certain applications do not support reloading, such as early versions of Hibernate, and some of the larger applications released by the Open Source community which are expected to run in a JVM of their own due to their size. The problem with these applications is usually that they don't clean up threads that are started by the application, or leak memory each time they are reloaded. For these applications we recommend a Dedicated JVM with a suitable amount of RAM. However, most applications run perfectly on a shared VM.
How we use these services ourselves
Metawerx is continually deploying new features and changes to the hosting tools you will use on your site, in exactly the same way as you are updating and deploying your own software.
As we have been doing this for years (since 1997), our own deployment process is quite mature.
We are often asked for advice on the best way to develop and deploy software to the servers. This is our current method:
* For all Metawerx internal applications, we use AutoDeploy
* First we modify the java source and project files, then compile locally to check for syntax errors. We use UltraEdit and ANT, or newer developers seem to prefer Eclipse.
* Next we check the changed java source into Subversion (supported at metawerx) for version control. This is as simple as a right-mouse button click, and typing a log message to record what was done and who did it.
* CruiseControl (supported at metawerx) notices the change and runs an automated build on our build server. This is the integration-testing phase. Java source, JSP source, taglibs and JSP tags are compiled. Unit tests are run against the code. PMD and CheckStyle reports are generated to ensure that our coding standards are met. Developers are then mailed a list of errors, or a successful build notification.
* On a successful build, we then test the application locally on our test environment.
* Next we run a Windows batch file (two clicks on the Desktop), which uploads the changes to multiple servers using RSync (supported at metawerx). Only changed files are uploaded, so this takes around 3-5 seconds. We exclude the web.xml file from the upload here to avoid a premature redeploy.
* Next, the script "touches" the web.xml file to update it's timestamp. Then web.xml is RSync'd to the server as the final step. This triggers Tomcat's AutoDeploy method and within 20-30 seconds the application redeploys automatically (no need to restart the JVM). At this point, the changes are live for all clients.
* Finally we perform live testing and notify relevant customers of the change.
As you can see, we use exactly the same tools and services which are available to our customers. If we ever find a faster method, we will start to use it internally, and we will also make it available to our customers.