Thursday, October 08, 2009

Drools Monitoring with JMX

Drools is designed to support multiple business scenarios. Some of them, known as Decision Services, usually use short lived, stateless session. Others, use stateful sessions, and specially in the case of CEP scenarios, it is very common to have long living sessions that frequently span the whole life of the application.

In such scenarios, the ability to monitor and inspect the contents of the knowledge bases and their associated sessions becomes more and more important.

Drools 5.1 brings support to the JMX standard and enables knowledge base and knowledge session monitoring and inspection using any JMX console. Bellow you can see some screenshots of VisualVM JMX console connected to the Drools Fusion example application.

Knowledge Base stats

Knowledge Base Configuration

Knowledge Session stats

Some of the stats are presented in consolidated graph/values, but individual rule stats are also available through JMX operations. That level of detail even allows users to know which rules are taking longer to fire or which ones are being canceled the most.

Happy Drooling.

3 comments:

  1. JMX is possibly the single worst way to expose any type of complex object state.

    http://williamlouth.wordpress.com/2008/07/16/the-good-jxinsight-bad-jmx-ugly-jmx/

    ReplyDelete
  2. William,

    Thank you for pointing out JXInsight. It looks like a cool technology indeed. On the other hand, good or bad, JMX is a java standard and publishing the stats to JMX MBeans means that Drools is immediately accessible from hundreds of tools out there that are JMX compliant.

    Also, some of the points you make on your blog about why JMX is "too intrusive" (like forcing the application to implement MBean interfaces) are in reality design decisions and not enforcements of the standard. But that is not the best forum for such a discussion.

    Finally, for profiling/debugging/development, JXInsight looks quite neat to use, but as you mention, for production you don't want to expose all that (and that is why you use AOP to remove the calls to the instrumentation). Drools JMX beans are supposed to be used in production for remote monitoring and being designed as they were, they don't bring any perf impact to the reasoning engine. The information was already there, we are just making it available now.

    Cheers,
    Edson

    ReplyDelete
  3. Can you provide examples of how you enabled the JMX MBeans shown in your screenshots? I am unable to find much documentation on how to configure/use this new capability in 5.1.0.

    ReplyDelete