Apache Tomcat is one of the most widely-used servers in the realm of Java-based web applications. Apache Tomcat is an open-sourced server that is often used for important web applications for enterprise users. However, as with all virtual machine technology, using Apache Tomcat comes with a responsibility to monitor it properly. In this Tomcat monitoring guide, we’re going to look at how to monitor Tomcat and some of the tools you can monitor it with.
Here is our list of the three best Tomcat Monitoring Tools:
- SolarWinds Server & Application Monitor (FREE TRIAL)
- ManageEngine Applications Manager (FREE TRIAL)
How do I Monitor Tomcat?
While network administrators on smaller networks may be able to get by on command-line scripts, ad-hoc monitoring isn’t the most efficient way to manage your resources. For more precise monitoring you will need to use an external monitoring tool. You have the choice between Java Management Extensions (JMX beans) or using a complete application monitoring solution. But before that, we’re going to look at what you should be monitoring.
What Should I be Monitoring with Tomcat?
Tomcat is a server all of its own. There are a number of metrics that you need to monitor to discover performance issues and maintain long-term performance. These are:
- Memory – One of the first things you should monitor is how much memory the server has available. A JVM with Low memory will lead to poor performance.
- Uptime – Measuring whether your server is up or down is essential for ensuring your service stays up. In the event that your monitoring tool reports that the service is down, you can start troubleshooting to find out why.
- Response time – The server should respond to user requests ASAP. If the response time is too long then you run the risk of losing users.
- Error rates – Recording the error rate shows you if there are any issues in your codebase. Monitoring error rates helps optimize your service.
- Request throughput – Monitoring request throughput tells you how many threads are active. If too many threads are active the application can perform poorly.
- Number of sessions – Measuring the number of sessions will tell you how many concurrent sessions the server can support simultaneously.
- Garbage collection – Garbage collection needs to be run at a certain frequency with the necessary amount of memory cleared once the collection is complete.
How to Query Tomcat Metrics with MBeans
If you’re using JMX beans to monitor Tomcat, you will be using JMX proxies to query metrics. However, in order to do this, you need to configure Tomcat and assign users and roles. You will need to configure the following roles: manager-jmx and manager-gui.
The first will enable the user to access the JMX proxy servlet and Tomcat’s server status; the latter allows the user to access the application manager where you can monitor for performance issues.
To assign a role to the user you need to update the conf/tomcat-users.xml configuration file and enter the following. (The command will create a new tomcat-jmx user, assign the roles listed above to the user and create a password for the account):
<role rolename=“manager-gui” /?> <role rolename=“manager-jmx” /> <user username=“tomcat-jmx” password=“<YOUR_PASSWORD>” roles=“manager-jmx,manager-gui”/>
To query Tomcat metrics you will need to access a JMX proxy servlet where you can query performance metrics via the web browser. Through your web browser, you can query the data of Mbeans or managed Java objects to view information about your server. You can view a list of MBeans available to monitor by entering the following:
When searching for an MBean you can add parameters to help you with your search. Parameters you can add to the command line include domain, type, name, and attribute. In the prompt these are as follows:
http://localhost:8080/manager/jmxproxy/?get=<DOMAIN>:type=<TYPE>, name=“ <NAME>”&att=<JMX_Attribute>
If you wanted to view the HTTP connector’s maximum request processing time you would enter the following:
The result would be the following:
OK - Attribute get 'Catalina:type=GlobalRequestProcessor,name="http-nio-8080"' - maxTime = 189
The limitation of using Tomcat to query metrics is that you can only look up one thing at a time. It is for this reason that we recommend using a third-party server monitoring tool to track multiple metrics simultaneously.
If you want to monitor a range of metrics simultaneously, then you’re better off with an application monitoring solution. One of the advantages of going this route is that you have a wide range of options to choose from in terms of providers.
In this section, we’re going to look at some of the best tools for monitoring Apache Tomcat.
SolarWinds Server & Application Monitor is ideal for monitoring Tomcat because it comes with a set of out-of-the-box monitor templates built specifically for the server. The tool can monitor Free Memory, Total Memory, Max Memory, Total Processing Time, Request Count, Bytes Sent, Bytes Received, and Errors Count.
To make for a more compelling visual experience, SolarWinds Server & Application Monitor has out-of-the-box dashboards as well. The JBoss monitoring tools feature shows performance and usage data of Apache Tomcat and Geronimo.
There are also performance reports built especially for Tomcat and Geronimo. However, these can be customized if you want to monitor different information. Once you’ve chosen how you want reports to be structured you can automate the program to send them to certain users via email.
- Offers pre-built templates specifically for Tomcat monitoring
- Supports auto-discovery that builds network topology maps and inventory lists in real-time based on devices that enter the network
- Intuitive alerting and notification system
- Uses drag and drop widgets to customize the look and feel of the dashboard
- Robust reporting system with pre-configured reports for Tomcat and Geronimo
- Designed for IT professionals, not the best option for non-technical users
SolarWinds Server & Application Monitor is recommended to those who want to monitor Apache Tomcat with a tool that is easy to use. The software is competitively priced at $2,995 (£2,389) with enough pre-configuration to get you up and running swiftly. You can download a 30-day free trial.
ManageEngine Applications Manager is an application monitor that can monitor Tomcat servers. The platform has the ability to monitor the CPU, memory, JVM usage, response time, and memory leaks. In addition, you can also monitor web application live sessions, JDBC connection pools, and thread pools. All of this data can be converted into graphs so that you can easily point to usage trends.
The Tomcat thread pool monitor is particularly useful because it allows you to monitor pool utilization. The program displays thread utilization stats on a graph with a list of metrics shown underneath. There is the option to configure alarms to alert you if certain parameters are met. You can also schedule thread dumps to make sure that your application server doesn’t get overwhelmed.
The tool also provides performance reports. Reports not only create a historical record for your performance data but also offer performance forecasting powered by machine learning. Forecasting can tell you whether you really need the server resources that you’re paying for. Once the report is generated it can be sent onward to your team.
- Offers on-premise and cloud deployment options, giving companies more choices for installation
- Can highlight interdependencies between applications to map out how performance issues can impact businesses operations
- Offers log monitoring to track metrics like memory usage, disk IO, and cache status, providing a holistic view into your Tomcat environment
- Leverages machine learning to monitor Tomcat thread pools, resource utilization, and JVM usage
- Can take time to fully explore all features and options available
ManageEngine Applications Manager is a tool designed for enterprises looking for application monitoring software that’s user-friendly. It has all the bells and whistles necessary to monitor Tomcat effectively with a competitive price point. The price ranges from $945 (£753) for 25 monitors to $7,195 (£5,740) for 250 monitors. The program is available on Windows and Linux. You can download the 30-day free trial.
AppDynamics is an application performance monitoring solution that can monitor Apache Tomcat. AppDynamics can automatically discover application code on Tomcat and shows a top-down perspective on the performance of the entire service. With this tool, you can monitor the performance, availability, and health of your server.
You can also monitor for more specific issues as well. Heap usage, garbage collection, and memory leaks are just some of the tricky server issues that AppDynamics can handle. Leaks are monitored automatically and the user can be sent an alert if there is a problem.
To send alerts, AppDynamics uses SLA base-lining to discover performance issues the moment they occur. The responsiveness of the alerts system helps to address application issues before they affect the end-user. There is also root-cause analysis to help get to the source of any performance problems.
AppDynamics is worth considering for organizations that want a comprehensive Tomcat monitoring tool that provides transparency right to the heart of application processes. If you’d like to know the price of AppDynamics then you can request a quote from the sales team. There is also a free trial available.
Tomcat Monitoring Tip: Choose a Method You’re Comfortable With
Monitoring Apache Tomcat relies on tracking several very specific metrics that you might lose sight of without a complete server performance monitoring platform, whether you choose to use JMX beans or application monitoring tools. Of the application monitoring tools on this list, we would recommend SolarWinds Server & Application Monitor, ManageEngine Applications Manager, or AppDynamics on account of their usability.
The key is to make sure that you’re monitoring Tomcat in a way that is comfortable for you. If you prefer the oversight of an external application monitor then use a performance monitor. If you prefer to query MBeans manually then feel free to do things this way as well!
Related post: Apache Web Server Monitoring Tools
Tomcat Monitoring FAQ
How do I monitor Tomcat thread count?
It is possible to monitor Tomcat thread statistics through JMX, however, this can be difficult to set up. It is much better to use a monitoring tool that has specialized routines for Tomcat monitoring together with server and JVM monitoring capabilities.
How many sessions can Tomcat handle?
The number of sessions that a Tomcat instance can handle is dictated by the maxThreads setting. By default, this is 200 so you would need to change this value in order to get more sessions active. Reports from testers suggest that Tomcat can manage up to 13,000 threads, which, put in other terminology is 13,000 connections or 13,000 sessions.
How do I know if Tomcat is running?
The default port for Tomcat is 8080. To check if Tomcat is running, open any browser and enter the address http://localhost:8080. If Tomcat is running, you will see the Tomcat homepage in your browser. You might have set up Tomcat to run on some other port. If that is the case, enter that port number instead of 8080. You can see that port setting in conf/server.xml.