The great thing about a conference like JavaOne is the fact that it brings talented, like minded people together. And when talented and self-motivated people start talking about their ideas and plans, small projects and part time endeavors turn into popular tools and enterprise solutions. For a recent example, the JClarity guys come quickly to mind. Kirk Pepperdine has always been a solid fixture at North American and European conferences, and guys like Ben Evans and Martijn Verbug have become increasingly more visible over the past few years. It was no surprise to see these guys joining forces and bringing a product like JClarity to market. In a similar vein, Kees Jan Koster has taken his interest in examining the internals of the JVM and packaged it up as an interesting new product named java-monitor, and with a little help from friends like Ulf Dittmer, more and more people are getting exposed to this interesting and easy to use monitoring tool.
About five years ago I noticed that a lot of JVMs were running unmonitored.
Kees Jan Koster
"About five years ago I noticed that a lot of JVMs were running unmonitored. Nobody was watching them and they would go down. Around the same time I learned about JMX, the internal management protocol for Java, and I was amazed how you can just look into the JVM and it will tell you everything," said Kees. And in five years, the work put into digging around the internals of the JVM has turned into a neat little monitoring tool that can "monitor your application severs, notify you if something goes wrong, and helps you to look into the JVM in a relatively understandable way."
Putting java-monitor to the test
A good test of any JVM tool is how well it works with a WebSphere Portal 8 installation. IBM provides its own JVM for portal installs, and while it is certainly standards compliant, it does have a flavor that is different from the JVM provided by Oracle and the OpenJDK. Furthermore, a portal installation beats down hard on a virtual machine, demanding a significant amount of memory and a large number of active threads to support just the applications that are installed by default.
Installing java-monitor on a WebSphere Portal installation turned out to be pretty easy. Installation simply consisted of deploying a war file onto the same server that was hosting the portal, and then bringing up the index page of the app. Somewhat surprisingly, going to the index page of the war file redirects you to java-monitor.com, which then displays a variety of stats about your application. Not much shows up at first, but after a day or two, interesting visuals appear describing heap usage, thread pools and memory consumption. And for each graph, there is a neat little icon you can click that allows the graph to be shared in the site's forums, allowing you to easily ask questions like "is this pattern normal?"
Perhaps the most important java-monitor option that admins will be interested in is the ability to configure alerts that will be activated any time the JVM goes down for a duration of two, five or twenty minutes. Alerts are then sent from the java-monitor site, either through an email, SMS message or both. The java-monitor site acts as a remote heartbeat monitor. As a result, if one of the JVMs go down in a cluster, the admin will know before the help desk starts getting flooded with calls.
"It's great for looking inside, but most other tools just give you a snapshot of what is happening. On the other hand, the java-monitor tool gets you at least a two day graph of everything that happens with regards to memory, garbage collection and threads" says Ulf, who has made the java-monitor part of the day-to-day operations management of the CodeRanch, formerly known as the JavaRanch, which hosts the Internet's largest online Java forum. It's all hosted using JForum, so knowing if a JVM is down, and avoiding any 'pants down' messages, is a pretty significant responsibility.
The software itself is available through a freemium pricing model, so using the java monitoring software to collect and graph two days worth of data at a time, configuring alerts, and using the associated forums is free. It's a neat tool developed by another one of those members of the Java community that's motivated by doing 'neat things' and contributing back to the community. Whether you want to monitor the local JVM hosting your Tomcat test environment, or the ones powering your production servers, it's definitely worth the few minutes it takes to download and install the java-monitor product.
How to you minimize the downtime of your JVMs? Let us know.