Monitoring Java systems
Instrument as early as possible and try JMX today
Earlier in the week I wrote about performance tuning Java systems and I hinted that being able to monitor a system is a really useful first step in proving and diagnosing the cause of performance issues. Of course, there are times where you need a profiler, but that's a different story.
So back to monitoring and I'm still surprised by the number of mission critical systems, particularly in the financial markets sector, where the only way to monitor the system is by tailing a log file. As for management, well, that's typically non-existent.
One of the things that I now do when I'm architecting a new system is to always spend a little time on thinking about the system from an operations/support perspective, reflected by including a "Monitoring and Management View" in my architecture documents. Ultimately, you need to work out what the non-functional requirements are, and a good way to do this is to sit down with the support team to run through the following sorts of questions.
- Who will be supporting the system?
- Where are they located?
- What is their skillset and experience?
- Will remote support be required?
- Do you think you'll want to reconfigure the system at runtime?
- How much control do you want over the log files?
- Do you have a standard monitoring infrastructure that the system should publish information to? (e.g. Tivoli, BMC, etc)
- Do you have existing scripts/code/etc for sending (for example) SNMP traps?
- What granularity of monitoring do you need?
- What granularity of management do you need?
- Do you need a single dashboard for the entire system?
Questions like these are important to ask because you really do need to tailor the monitoring and management to the people that will be supporting the application. Of course, like all functionality, you do need to prioritise monitoring and management features because they do have an associated cost. Similarly, you also need to perform some cost-benefit analysis because it's no good building a comprehensive web-based administration system for a tactical solution that only has a 3 month lifepsan, for example.
With Java, a really effective way to monitor and manage applications is using the Java Management Extensions (JMX). As I've said before, JMX is one of those technologies that rarely gets a look in, but once you get into it, you'll become infected. Using JMX is straightforward enough, but you do need to work out what you want to monitor and manage. With this in mind, I would recommend getting those hooks in as early as you can. Finally, even if you *really* don't have the time to instrument your code, you can get a certain level of JVM monitoring for *free*, just by enabling the JMX agent. Try it, you have no excuse not to!
Simon is a hands-on software architect and has a BSc (Hons) in Computer Science from the University of Reading. Over the past 12 years, he’s been involved in projects ranging from rich desktop clients and web applications through to highly scalable distributed systems and service-oriented architectures; predominantly within the finance industry. He's also undertaken consulting and training roles with a broader focus on people, process and technology.


