Using Apache Tomcat In Production - Tools, Tips, and Tricks

As lightweight frameworks and other modern technologies have simplified the 'moving parts' of enterprise web applications, many organizations have begun to scrap bloated Java EE stacks and move to lightweight Apache Tomcat.  As of 2010, Apache Tomcat is officially the most popular Java application in the world, with over 70% penetration in the enterprise data center.  

In this article, we provide a comprehensive introduction to using Apache Tomcat in production for organizations considering migration.

Using Apache Tomcat In Production

I. Meeting Enterprise/Production Needs

II. Common Strategies For Administrators

III. Tcat Server - Apache Tomcat For The Enterprise

I. Apache Tomcat In Production - Meeting Enterprise/Production Needs

The standard distribution of Apache Tomcat is production-ready in terms of performance, stability, and security.

However, in an effort to preserve Tomcat's light weight and flexibility, Apache Tomcat ships with only minimal administrative capabilities and tooling.  When using Tomcat in a large scale production environment, these tools almost always prove inadequate.  Thus, most administrators implement some form of additional monitoring/deployment/configuration management tactic.

Although specific needs will naturally vary by use case, almost every enterprise Apache Tomcat administrator needs the following capabilities:

Server and Web Application Diagnostics

An effective set of diagnostic capabilities are essential in any enterprise environment, whether development or production.  

In development, the ability to quickly edit configurations and get visibility into the performance of a server or application under load allows for the efficient optimization of code and configuration that will translate into stellar performance in production.  

In production, the ability to monitor response times, trail logs, and tweak configurations to handle unexpected load is the number one key to everything from avoiding downtime to identifying malicious traffic before it becomes a problem.

While Tomcat includes a number of command line utilities that can be used to obtain basic information about a web application, as well as a few basic graphs as part of its Manager application, its features are a far cry from being a comprehensive set of effective diagnostic tools.

Configuration Management

Properly tuned configuration is the key to great Tomcat production performance.  Web application performance, not server performance, accounts for roughly 80% of all bottleneck in the typical enterprise Java environment.  For this reason, the ability to quickly and easily enforce configurations across a distributed infrastructure is essential in production.

Apache Tomcat is configured via a number of XML configuration files.  When only managing one or two Tomcat instances, it is relatively easy to work with these files by hand or via a script interface.  However, when using Tomcat in a clustered, secured enterprise environment, this quickly becomes unfeasible.  

Without additional tools, an administrator wishing to make a small change to an attribute used throughout the infrastructure would have to log into each Tomcat instance and manually edit the file.

Reliable Deployment and Provisioning

Although Tomcat includes a lightweight management application, its limited feature set is generally not robust enough for an enterprise environment.  The Tomcat Manager lacks key enterprise features such as deployment to multiple servers, version provisioning and rollback.  Using it to manage anything more than a very simple infrastructure is not feasible.


Although the benefits of moving to open source Apache Tomcat are clear from a pure data standpoint, some organizations are wary of migrating from a commercial product with a support and services contract, such as WebSphere or WebLogic, onto an open source project without dedicated support.  Tomcat's popularity among enterprise companies in spite of this concern has led to the creation of a large number of third party companies who offer professional support for Tomcat.

As mentioned above, the cost and productivity benefits of migrating to Apache Tomcat are so compelling that most teams are willing to accept the fact that they will be building some kind of additional management framework on top of their new infrastructure.  

II. Apache Tomcat In Production - Common Administration Strategies 

There are a variety of approaches that teams commonly use to enable Tomcat to be used in production from an administrative standpoint.  Generally, administrators will use two or more of these approaches in tandem to provide the specific functionality required by their organization.

Service Wrapper

Running Tomcat within a Java Service Wrapper such as JSWYAJSW, JavaService, or AlwaysUp extends Apache Tomcat's existing management capabilities to a certain extent.  Specifically, a service wrapper may be able to automatically restart a Tomcat instance if failure occurs, perform manually scheduled restarts, and take thread dumps on application or server failure.  

What a service wrapper does NOT provide is a standardized method of remote management (for example, via JMX).  This is almost always a necessity in the enterprise, and as such, service wrappers on their own are not enough to effectively administrate Tomcat.

With some extra configuration, Apache Tomcat also can be run as a service without an additional service wrapper.  For more information, visit our guides to Tomcat Service Configuration and Tomcat Start-Up

Custom Scripts and Command Execution Utilities

One of the most popular methods of managing large Tomcat infrastructures is to use a combination of custom scripting (shell, Ruby, Python, Groovy, Perl, etc.) and either custom, open source, or commercial utilities which allow these scripts to be run against large numbers of remote servers simultaneously.  

When using a smaller number of Tomcat servers, administrators may simply configure SSH keys on each of their servers, and then control them from a custom console.  Although simple to implement for small networks, this approach is unfeasible in large-scale enterprise environments.  To get around this problem, some administrators implement an additional configuration management tool, such as Puppet.

Due to the difficulty of building and maintaining a script-based management implementation from scratch, some teams turn to utilities such as GSHTentakelFanout, p-run, and more to help bridge the gap between their homegrown systems and enterprise-scale management.  These distributed command execution utilities allow scripts to be run against pre-defined groups of servers.  


JMX, or Java Management Extensions, is a technology that allows Java components and their attributes to be exposed as remotely manageable resources.  

Resources that are represented by a managed bean, or Mbean, are able to notify the JMX agent layer, called the MbeanServer, of changes to internal attributes, while the client layer can send a message through the agent to change these values remotely.

The central component of Apache Tomcat, called Catalina, can be exposed as a managed bean, giving administrators remote access to most of Tomcat's functionality.  When combined with scripting or custom built consoles to help automate the management process, JMX can be a powerful Tomcat administration tool.  

However, JMX has some limitations.  For one thing, as only the Tomcat instance itself is exposed via JMX, management of the JVM itself must be accomplished in a different way - usually through yet another custom-built solution.  Secondly, as with any custom-built management solution, using JMX also requires implementing security.  While JMX has some security capabilities, configuring these is a non-trivial process.

For more information about configuring Tomcat's built-in JMX functionality, visit our Tomcat JMX guide.

III. Tcat Server - Apache Tomcat For The Enterprise

Tcat Server is the enterprise version of Apache Tomcat.  Tcat Server leverages the proven power of an unmodified Apache Tomcat core, while adding the streamlined, comprehensive set of enterprise features necessary to use Tomcat in production environments.

Tcat Server's additional features for enterprise administration enable organizations to make the move to Production Apache Tomcat.

Server and Web Application Diagnostics

As we show above, well-implemented diagnostic tooling is absolutely essential when using Apache Tomcat in production.  Using Tcat Server's central web console, get deep, powerful visibility into your infrastructure and applications.  

  • Real-time performance statistics, at-a-glance application and server health  
  • Centralized log management
  • Pro-active alerting - configure the alerts you care about, and receive updates by phone or e-mail

Configuration Management

The right configuration is everything when it comes to running Tomcat in production.  Tcat Server provides centralized remote configuration management and enforcement for your entire infrastructure.

  • Create custom server profiles and apply to groups of servers with a single click
  • Remotely edit Tomcat configuration files
  • Reliable remote restarts

Error-Free Deployment, Application Provisioning, and Versioning

In production, you can't afford to spend time worrying about deployment errors or manually deploying applications to multiple applications.  Tcat Server provides the rock solid deployment features you need.

  • Create a package of applications and deploy to all server groups with a single click
  • Immediate feedback on the status of a deployment
  • Application provisioning and one-click version rollback
  • Continuous deployment


Enterprise infrastructure needs enterprise support.  Unlike standard distributions of Apache Tomcat, which are unsupported, Tcat Server is fully backed by MuleSoft's award winning support team.  All Tcat Server licenses include standard enterprise support packages, with the option to upgrade to 24/7 support if needed.