3 Replies Latest reply: Feb 17, 2010 3:10 PM by Paul Ferraro RSS

Exposing load metrics via JMX

Marek Goldmann Master



I'm trying to get load metrics values via JMX. I cannot see getLoad() method to be exposed in a load metric bean.


How can I obtain load let's say for BusyConnectorsLoadMetric via JMX?



  • 1. Re: Exposing load metrics via JMX
    Paul Ferraro Master

    At the moment, you cannot fetch individual load values via JMX.  The getLoad(...) method on LoadMetric requires a LoadContext.  Consequently, this is not usable as a mbean method.  With some work, however, you can achieve what you're looking for.


    First, extend the LoadMetricMBean interface with the following:


    public interface MyLoadMetricMBean extends LoadMetricMBean
      double getLoad();



    Next, extend the BusyConnectorsLoadMetric impl, and implement getLoad().

    We'll express this metric's load in terms of its capacity:


    public class MyBusyConnectorsLoadMetric extends BusyConnectorsLoadMetric implements MyLoadMetricMBean
      public MyBusyConnectorsLoadMetric() throws MalformedObjectNameException
      public double getLoad()
        MBeanQueryLoadContext context = this.getSource().createContext();
          return this.getLoad(context) / this.getCapacity();



    Now use the new load metric impl and mbean interface in your *-jboss-beans.xml config:


    <bean name="BusyConnectorsLoadMetric" class="org.jboss.modcluster.load.metric.impl.MyBusyConnectorsLoadMetric" mode="On Demand">



    On second thought, this seems like a useful method to expose via JMX.  I'll create a feature request.

  • 2. Re: Exposing load metrics via JMX
    Michael Neale Expert

    That looks like a really nice idea to bake in. Does any one know how JOPR manages to dig this out:


    For example: http://www.jopr.org/display/JOPR2/Web+Application+(WAR)+Service#WebApplication%28WAR%29Service-Metrics

    (just want to make sure there isn't an existing path for this data that we are missing).

  • 3. Re: Exposing load metrics via JMX
    Paul Ferraro Master

    It looks like Jopr uses the same JMX-based mechanism as mod_cluster to detect connector thread busyness:



    BTW - I've created a feature request for this topic: