Monitoring JBoss with Monitis – Part 2

In a previous article we introduced the JBoss JMX monitoring capabilities and the Monitis JMX agent. Since most JEE web applications store data in relational databases accessed through JDBC, and the database is the most frequently cited source of performance bottlenecks,  let’s take a closer look at how Monitis can help you keep tabs on your connection pools.

Once you have installed the .WAR file in your JBoss application server, follow these steps to setup your monitors:

Step 1: Open a web browser and navigate to http://<server-name>:8080/mon_jmx_agent.  On the login page, enter your Monitis credentials. The JMX agent will use these credentials to authenticate against your Monitis account:

Step 2: The agent will prompt you to enter an agent name. If you are setting up new monitors, choose a unique agent name. Typically, you would have one agent per JBoss server, so it’s a good idea to incorporate the host name when naming the agent. On the other hand, if you have already created JMX monitors for JBoss and would like them to run on this specific JBoss server, enter the name for the existing agent. The JMX agent will then download the monitor metadata from your Monitis account in the cloud and start collecting data.

Step 3: When prompted for JMX Service Parameters, make sure you enter the correct JMX port number. The default port for JBoss 6.x is 1090. To find out what the setting is on your server, consult $JBOSS_HOME/server/<instance_name>/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml. Out of the box, the JBoss JMX connector does not require a username and password.  In a production environment you should definitely secure the JMX Invokers.

Step 4: On the next page, select jboss.jca from the Domain drop-down and navigate to jboss.jca:Service=ManagedConnectionPool,name=<your connection pool Name>

Step 5: Choose a meaningful name for your monitor, select a Check Interval (time is in minutes) and select the following MBean attributes to monitor and click the Add Monitor button on the bottom of the page:

  • AvailableConnectionCount
  • ConnectionCount
  • ConnectionCreatedCount
  • ConnectionDestroyedCount
  • InUseConnectionCount

Step 6: Log on to your Monitis account and go to Monitors -> Manage Monitors -> JMX Monitors.

Select the check box next to your newly created monitor and click the Add to Window button. The new monitor will appear on your Monitis dashboard:

So, what’s in it for you? The connection pool metrics we selected are self-explanatory. Arguably the most important one is AvailableConnectionCount. If this drops to zero, it means that your clients are waiting for the application to acquire a connection from the pool, resulting in degraded performance and possibly timeout errors. In such cases you may want to increase the maximum number of connections in the pool, but, think carefully – more often than not, a low AvailableConnectionCount is an indicator of a poor design where the application is holding the connection for too long and is not returning it to the pool, or slow-running database queries which are in dire need of optimization.

That’s it for this installment. Happy monitoring!