The Apache Tomcat is an open-source implementation of the Jakarta Servlet, Jakarta Server Pages, Jakarta Expression Language, Jakarta WebSocket, Jakarta Annotations and Jakarta Authentication specifications, all being a part of the Jakarta EE Platform.
That is the official description of Apache Tomcat. But, to put it simply, it is an Apache 2.0 licensed, open-source application that powers numerous large-scale applications and small businesses in need of running their servlets and server pages, but without the need for a full Jakarta EE environment.
No matter what kind of applications are powered by your Apache Tomcat instances, it is crucial to ensure that they are running healthy, don’t have any issues, and that the platform they are running on doesn’t have any problems and can operate without any bottlenecks. It is also very important to foresee any problems that may be happening in the environment and when issues happen, be able to properly troubleshoot and do a deep post-mortem analysis, so that the root cause of the issue is identified and fixed to prevent any further failures.
In this blog post, we will discuss the key Tomcat metrics you should measure and review some of the best monitoring tools available.
Key Tomcat and JVM Performance Metrics to Measure
We can divide the key Tomcat metrics you should monitor into the following categories:
Operating System Metrics
The operating system is not visible at first glance, but it plays a critical role in Apache Tomcat health. If the OS is not healthy, applications running on top of it will also likely suffer.
The CPU of the environment Tomcat is running on will be used to process each request. Because it’s a JVM application, Tomcat will use CPU for garbage collection as well. That’s why this is one of the crucial metrics you should keep an eye on.
The more spare CPU cycles you have in a given environment, the more requests it can handle. The user part of the CPU usage will show you your Tomcat process needs, while the wait can point to a bottleneck in I/O or network. You should avoid situations where the CPU is constantly at 100% utilization because it potentially means that the server running Apache Tomcat is overloaded.
Memory usage is crucial for every JVM-based application, including Apache Tomcat. Keep in mind that the memory assigned to the JVM running Tomcat is not only used by Tomcat but also by the applications running inside it.
The general rule of thumb is that you want to avoid your operating system swapping the memory needed by the JVM. Otherwise, you will end up with a very slow JVM, resulting in the slowness of Tomcat and the applications running inside it.
Java Virtual Machine Metrics
The Java Virtual Machine is the runtime environment needed to run Tomcat. You need to make sure that it is healthy and running efficiently. Otherwise, your application performance will be suboptimal. Here are the JVM metrics that will help you troubleshoot Tomcat performance when needed:
The memory available to the Java Virtual Machine, the memory the JVM actually uses and the amount of memory available for processing are very important. You should monitor your Tomcat JVM memory usage, especially:
- Initial memory size – the initial size of the memory requested by the JVM during startup.
- Maximum heap size – the maximum possible size of memory that the JVM will be assigned to the JVM by the operating system.
- Used memory size – the amount of memory currently used by the Tomcat and the JVM it runs on.
In most cases, you want to avoid resizing your JVM heap because of performance reasons. In addition, making sure that the initial memory is equal to the maximum heap size ensures that during the lifetime of the Tomcat process, there will be enough memory for the maximum to be reached. Otherwise, the process will fail to start and give you insights into problems right away.
The key metric to be alerted on and to watch for is the used memory heap size. Your Tomcat instance JVM needs to have enough memory to work efficiently. The alert threshold depends a lot on your garbage collector, but in the case of newer garbage collectors, you want the heap memory to be below 85 – 90%.
It is worth mentioning here that it’s useful to also monitor Apache Tomcat logs as they help detect out of memory errors. Such events indicate that there are memory issues – either the heap size is too low, or you have some memory leaks in your application.
Your JVM will assign objects on the heap, use them and discard them eventually. The discarded objects must be cleaned up, which is the garbage collector’s job. A properly working Java garbage collector is the key to your application health and thus key to the health of the Apache Tomcat.
You need to keep an eye on the collection count and collection time – especially on spikes that happen for one or both of the mentioned metrics. Correlating such spikes with an increase in requests count can potentially tell you that it is just a matter of higher traffic. But if you can’t correlate the spikes to any particular metric such events may indicate inefficient code or even Java memory leaks.
Apache Tomcat Metrics
Apache Tomcat itself exposes metrics via the JMX. There are quite a few metrics that can be monitored inside your Tomcat instance, but some are more important than others.
Request Throughput and Latency
The information regarding requests is crucial to get details about how the incoming requests are handled, how fast or slow they are, how many there are, and so on. Here’s the data you should consider:
- Request count – the number of requests for all the connectors defined in Tomcat. The higher the metric, the more busy your applications are.
- Request processing time – the time needed to process a single request. The lower the time, the more efficient your requests are. High processing time means that the processing is slow. If you don’t anticipate that, it is something that may be worth looking at, because some of the application code is just slow or there is an infrastructure issue happening at the same time. You may want to set an alert on this metric to notify you when the time crosses a defined threshold.
- Maximum request time – the longer time Tomcat needed to process a single request. This metric shows the least performing request that your Tomcat instance was processing. You should pay close attention to it as it potentially points out issues with request processing.
Thread Pool and Executors
Each request executed by Tomcat requires a thread for processing. To control the processing, Aache Tomcat maintains a thread pool and executors, depending on the configuration, which help you understand how internal resources are utilized. Below are the key thread pool metrics that Tomcat exposes:
- Current busy threads – the number of threads currently in use by the in-flight requests.
- Maximum threads – the maximum number of threads that Tomcat can run simultaneously.
When Tomcat uses executors, you should monitor the following metrics:
- Active count – the number of active threads used for processing.
- Maximum size – the maximum number of threads that can be run concurrently and used for requests processing.
No matter if you are using executors or thread pool, the metric you should keep an eye on is the number of active threads. I suggest having two separate alerts here – one with the warning severity that will be triggered when the number of active threads reaches around 80% of the maximum number of threads, and the second with high severity when the number of active threads reaches 90%. These values can vary depending on how mission-critical your application running on Tomcat is – make sure to adjust them according to your use case.
Errors give us information about the issues with the Apache Tomcat instance itself, the errors with the application powered by it, the clients, or even the JVM itself. The most important metrics we can get out of Tomcat JMX when it comes to errors are as follows:
- Error count – the number of errors generated by the server when processing the requests. You should keep an eye on those and check for any anomalies. If the number of errors jumps, you should try correlating it to the recent deployments, new features, or increased traffic that may have caused that.
Some of the key information regarding errors is also not available via JMX. Things like out of memory, server-side, and client-side errors are only available in the logs. You need a dedicated log centralization solution and metrics monitoring to fully understand what is happening inside Tomcat.
How Do You Monitor Performance: Best Apache Tomcat Monitoring Tools
Now that we know what metrics we need to look into, we can finally look at the tools that can help you monitor Apache Tomcat to give you full observability.
Sematext Monitoring is a full-stack monitoring platform that provides all the capabilities and metrics you need for efficient Apache Tomcat monitoring. With this all-in-one tool, you get pre-built, customizable dashboards to map out metrics from all the components of your Tomcat environment – Tomcat itself, the Java Virtual Machine and the operating system. Sematext features powerful alerting that helps you avoid spending time constantly keeping an eye on what is happening with your system.
- Automated discovery for both Apache Tomcat instances and their logs gives you a more in-depth overview.
- Easy to deploy anywhere from bare metal or virtual machines to Docker and Kubernetes.
- Support for various environments such as bare metal, virtual machines and containers, making it easy to monitor Tomcat no matter the technology you choose.
- Automatic discovery identifies Apache Tomcat services automatically, enabling hands-off monitoring, as soon as you start.
- Alerting with anomaly detection and alert importance make it easy to be informed about the necessary Apache Tomcat metrics changes, such as response times.
- Quick and easy setup with auto-discovery makes it very simple to start monitoring Tomcat, whether the environment is static or scalable.
- Support for logging and real user monitoring, useful when you need to correlate the spikes in metrics such as average response time or high number of inflight threads with the increase in traffic.
- Limited support for transaction tracing makes it impossible to view the transaction starting in the frontend and ending in the data store.
- Lack of full-featured profilers.
Sematext’s pricing is simple yet very flexible. You can have a different plan depending on your needs and requirements. Tomcat performance monitoring is metered by the hour, making it suitable for static and dynamic environments designed and configured to scale up and down. It starts with $0.005 per agent per hour for the standard plan and 7 days of monitoring data retention.
Nagios is one of the oldest, most well-known and established monitoring tools available on the market for Tomcat monitoring, offering both an open-source and a commercial enterprise solution, Nagios Core and Nagios XI, respectively. Nagios Core is Linux-based and gained popularity due to being built with extensibility in mind and because it supports monitoring for various other technologies via official and community-developed extensions.
- Extensible architecture with many official and third-party plugins supporting technologies like Apache Tomcat and more.
- Problem remediation functionality enables automation of administrative tasks such as Tomcat restart in case of out of memory errors.
- Alerts with escalation capabilities ensure that the 500s that started happening in your Tomcat-powered application will be delivered instantly to the appropriate people.
- Availability reporting makes it easy to ensure that the SLAs for your mission-critical Tomcat-powered applications are met.
- Comprehensive monitoring for all mission-critical infrastructure elements makes it a single place to go when troubleshooting Apache Tomcat issues and not only.
- Open-source solution with a user-friendly license.
- Requires an external plugin to monitor Apache Tomcat and provide all the necessary metrics.
- To have full visibility into Tomcat instances, you will need to set up multiple plugins, and you will need quite a lot of manual work to make everything work.
The basic Nagios Core is free and can be used without limitations. Nagios XI, the more feature-rich version of Nagios, comes in two different versions – Standard starting at $1995 per 100 nodes and Enterprise starting at $3495.
Zabbix is an open-source monitoring tool allowing monitoring of all of your Apache Tomcat instances. It’s popular due to the large number of supported integrations, thus giving you a single pane of glass for monitoring various technologies within your infrastructure. With its multi-system agents, you can monitor Tomcat no matter what kind of environment it run in and create alerts based on the gathered metrics. With their template-based setup and auto-discovery, you can speed up even the largest setups.
- Powerful dashboarding for gathering the necessary Apache Tomcat metrics in a single place to have a full view in a single place.
- Template-based host management and auto-discovery for monitoring large environments hosting large numbers of Tomcat instances that change dynamically.
- Notifications with out-of-the-box support for email, SMS, Slack, Hipchat, and XMPP give you many options when configuring your alerts so they can be delivered to the appropriate stakeholders.
- Lightweight agent makes it a perfect fit for mission-critical applications running on Tomcat.
- Support for all relevant infrastructure components giving you complete visibility into all key elements that affect Apache Tomcat performance.
- Open source with strong community and commercial support.
- Initial setup and configuration may be troublesome and requires manual work.
Zabbix is open-source and comes with no license fee.
4. Tomcat Manager
Tomcat Manager is an application included in the Apache Tomcat distribution that allows managing applications and hosts in a single place. When it comes to monitoring, the Tomcat Manager web interface allows viewing the basic JVM metrics and the Tomcat metrics that are exposed via JMX.
- Out-of-the-box visibility in the current Tomcat state, such as the JVM memory information.
- Provides the view over the threads that are currently active with their state.
- Allows querying the JMX metrics exposed by Apache Tomcat for quick access to the information we need.
- Ease of use – requires only a small degree of configuration – adjustments of the user credentials and role.
- Lack of visibility into the historical metrics making it very limited in use as a full monitoring solution.
- Lack of graphical metrics representation.
There is no pricing associated with Tomcat Manager as it is a free application bundled with every Apache Tomcat distribution package.
JavaMelody is an open-source, Apache 2.0-licensed monitoring application you can deploy along with your applications to enable Tomcat monitoring. Easy to integrate and lightweight, it doesn’t need any external data store or code instrumentation. With JavaMelody, you get a set of predefined counters such as incoming HTTP requests, number of errors and warnings, as well as metrics around Java Virtual Machine memory usage and CPU usage.
- Provides the necessary metrics regarding the Java Virtual Machine that Tomcat is running on.
- Requests statistics with detailed information about inflight requests processed by Apache Tomcat.
- Summarizes the errors happening inside Tomcat to easily identify the most common ones for quick resolution.
- Mature, stable and with a very low overhead requiring no additional data store to operate.
- Access to metrics observed by JavaMelody itself and the ones reported by Tomcat via the JMX interface.
- Rich plugins allow you to use JavaMelody as a monitoring solution for Tomcat and other Java EE technologies limiting the technology stack.
- Alerting requires custom scripting.
- The interface may be seen as dated compared to more modern solutions.
JavaMelody is an open-source, Apache-licensed application that you can use without any licensing fee.
JConsole is a graphical monitoring tool for local and remote Java Virtual Machine instances. It leverages the Java Management Extensions technology and provides insights into the data exposed via it. This is perfectly suitable for ad-hoc Apache Tomcat monitoring, as it exposes its metrics via JMX. While pretty simple, it is an effective solution for gaining insights into the running JVM instance if you have access to it.
- Basic view over the basic JVM metrics on which Apache Tomcat is running, such as the number of JVM threads and the JVM heap usage.
- Graphical representation of the basic JVM metrics.
- Real-time view into the Tomcat metrics exposed via the JMX, such as the number of errors in Tomcat.
- Simple and fast to use.
- Provides insight into the basic JVM metrics and Tomcat instances for quick issue remediation.
- To get the monitoring data, you need access to the JVM instance so that you can connect to it.
- No view over the trends and historical data makes it not very useful for post-mortem analysis of the Tomcat metrics.
- Limited graphing capabilities.
Jconsole is a free Tomcat monitoring tool as it is a part of the Java Development Kit distribution package.
AppDynamics offers monitoring tools with an Apache Tomcat as a first-class citizen. Available as software as a service and on-premise, it offers support for Tomcat performance monitoring regardless of the environment you run your instances on. With AppDynamics, you can access any metrics that Tomcat exposes via JMX and alert on them, giving you full visibility into each instance you run inside your environment.
- Visibility into all the JMX beans exposed by Tomcat from the UI and the JVM memory pools.
- Alerting with email templating and period digest capabilities to bring detailed information about the cause of the issue.
- View of all Apache Tomcat startup parameters.
- Code-level visibility and automated diagnostics for quick troubleshooting of errors related to the applications running inside Tomcat.
- Machine Learning supported anomaly detection and root cause analysis features for quick issue resolution.
- Up to code level insights for easy detection if the issues are related to Tomcat or the applications using it.
- Visibility into connections between system components, environment elements, endpoint response times, and business transactions.
- Complex and very high pricing targeting large enterprises with more conventional high-touch sales strategies.
- The lowest price plan does not include some basic metrics such as network utilization, memory, or system CPU, providing a limited overview of your Apache Tomcat performance.
- Manual setup required – operations such as downloading and starting the agent are required; no one-line installation and setup command.
Pricing depends on the number of CPU Cores and the plan you opt for. The plan for US-based locations for full Apache Tomcat visibility includes application performance and infrastructure monitoring and is listed as $60/month per CPU Core.
Datadog is a comprehensive software as a service monitoring solution with Apache Tomcat monitoring capabilities. The default configuration provides the basic Tomcat metrics you need to understand the performance of your instances. For improved visibility, you can configure the agent to collect additional metrics and logs. The tool features anomaly detection and alerting based on machine learning that helps you with alert fatigue and focus on the important information regarding your Apache Tomcat instances.
- Overall metrics related to Tomcat, such as error count, request count, and request processing time, giving you an overview of how fast the requests are.
- Tomcat thread pool metrics with the information on the number of available threads and the number of busy threads showing you how occupied your Tomcat instances are.
- Apache Tomcat servlet processing times.
- Alerting with anomaly detection.
- Apache Tomcat integration supported out of the box with the default agent package.
- Logs centralization and analysis available in the same agent, so you can monitor both Tomcat metrics and logs and correlate them – for example, correlate the request spike with out of memory errors.
- Dashboard framework for building Tomcat tailored visualizations combining metrics and logs and sharing those with the team.
- Network and host monitoring for full visibility into the environment that your Apache Tomcat instances are running in.
- The initial installation process can be overwhelming if you want to verify and adjust the provided example configuration for Tomcat.
- The pre-built, out-of-the-box dashboard may not give you full visibility, which means you will have to spend time adjusting it to have the full visibility into your Apache Tomcat instances.
Datadog’s pricing varies depending on what part of the solution you use. If you need only basic Apache Tomcat monitoring, you can opt for application performance monitoring. This plan starts at $31/host per month when billed annually or $36/host per month when billed monthly.
Dynatrace is a full-stack observability tool with support for Apache Tomcat. It provides a powerful and user-friendly approach to monitoring your Tomcat instances with support for all common runtime environments such as Docker, Kubernetes and OpenShift, as well as popular cloud providers including Amazon Web Services, Google Cloud Platform and Microsoft Azure. It gives you end-to-end visibility into the metrics, dependencies and cooperation between various elements with the automatic discovery of your infrastructure elements so that every communication path is visible and monitored.
- Out-of-the box Tomcat monitoring dashboards and alerting.
- Full visibility into Tomcat requests showing the whole context of the request execution.
- CPU hotspot analysis for quick insights into where the most time is spent during request processing – background threads, schedulers, or Tomcat services.
- Automatic discovery of Apache Tomcat services with dependency visualization for full visibility into the interconnections.
- AI-powered anomaly detection with root cause analysis increases the speed at which you can fix the issues in your Tomcat-powered environment.
- Support for a wide variety of technologies.
- The number of features may be initially overwhelming.
- Can quickly become expensive.
Pricing is organized around features. Application performance monitoring pricing depends on hosts and the amount of memory available on a host. Each 16GB is a host unit, and the price is calculated based on the number of host units in an hour.
10. SolarWinds Server & Application Monitor
SolarWinds Server & Application Monitor provides monitoring of Apache Tomcat instances for those of us who would like to run an on-premise monitoring solution on Microsoft Windows. It provides all the key Tomcat metrics with out-of-the-box alerting to minimize the time spent looking into the metrics. With the flexible dashboarding and focus on the Microsoft ecosystem, it is a great choice if you run Tomcat along with the Microsoft products.
- Full support for all the relevant Tomcat metrics, including errors, memory, traffic and processed data.
- Out-of-the-box alerting.
- Easy integration with Microsoft Windows-based services, like Active Directory for user management.
- Support for a plethora of technologies, including network devices, databases, and virtualization platforms for complete visibility into the environment where Tomcat is running.
- Available only in the on-premise model.
- The only supported platform is Microsoft Windows.
Subscription and perpetual licensing are possible starting at $1,275, with a 30-days free trial available.
11. ManageEngine Applications Manager
ManageEngine Applications Manager is a unified application performance monitoring tool with support for a number of applications. It supports Apache Tomcat monitoring whether it runs on its own, or it’s part of JBoss application server. This solution works with all common infrastructure architectures, including bare metal, virtual machines, and containers, making it easy to monitor Apache Tomcat regardless of the runtime environment you are using.
- Alerting engine with notifications support to notify you when there are issues with your Tomcat or applications running on top of it.
- Per web application metrics showing you all the necessary details related to each application running inside your Apache Tomcat.
- Support for Tomcat metrics no matter which environment you use to power your business – Amazon Web Services, Microsoft Azure, Google Cloud Platform, OpenStack, or bare metal.
- All necessary and useful Tomcat metrics available out of the box, including requests, memory and thread pool-related metrics.
- Customizable dashboards for better visibility, allowing you to focus on crucial Tomcat metrics.
- Hotspot detection for quick insights into potential problems with Tomcat and the applications powered by it.
- Docker and Kubernetes integrations make it easy to monitor Apache Tomcat running in containerized, dynamic environments.
- Lack of support for metrics and logs correlation.
ManageEngine Applications Manager has two pricing tiers – Professional and Enterprise. Both depend on the selected version, the number of monitors, and the number of users using the product with the free version available.
It doesn’t matter if you need to monitor a plethora of Tomcat instances that power your mission-critical application that needs to be up and running with 99.999% uptime or if you have a small application used by dozens of users. There are metrics you should be aware of, and monitoring helps you ensure that you won’t lose track of them. Regardless of the Tomcat monitoring tools you will go with in the end, keep in mind that depending on the situation, you may need the ad-hoc or historical view into the Apache Tomcat metrics.
Hopefully, our comparison will help you choose the right solution for your specific use case.