Sunday, March 29, 2009

JMX

And so I've been tasked to create a JMX-based statistics tracker. A key part of my task will be to implement the infrastructure to allow MBeans to be easily created throughout the system, although its first usage will be for monitoring cache statistics and batch performance.

Presently I'm using static objects to store cache hit/put/miss counters. This suffers from the accuracy-vs-performance problem in multi-threaded environments.

And I'm using IBM's ThreadSafeTimeUsed class for measuring batch processing execution time. This uses Timelets, which basically is a new object created each time the timer is started, after which the total time for all the corresponding objects will be calculated for that timer. Since nothing is modified concurrently (even the Timelets container is thread-local), this implementation is pretty much thread-safe. But there is presently no way to retrieve results dynamically during runtime.

JMX will solve the above problems. By sending counters and timer events to an MBean (should this be kept thread-local?), a client on a remote machine can monitor the required statistics dynamically without affecting runtime performance.

Hibernate supports JMX, so maybe I'll start here first. I will also need a client to do the monitoring. MC4J is the option I found on Google, but the Oracle JRockit Mission Control tool is able to monitor MBeans registered on JRockit, so I might be able to use this too.

So here we go.

No comments:

Post a Comment