-
1. Re: Exposing load metrics via JMX
pferraro Feb 12, 2010 9:43 PM (in response to goldmann)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:
{code}public interface MyLoadMetricMBean extends LoadMetricMBean
{
double getLoad();
}{code}
Next, extend the BusyConnectorsLoadMetric impl, and implement getLoad().
We'll express this metric's load in terms of its capacity:
{code}public class MyBusyConnectorsLoadMetric extends BusyConnectorsLoadMetric implements MyLoadMetricMBean
{
public MyBusyConnectorsLoadMetric() throws MalformedObjectNameException { super(); }
public double getLoad()
{
MBeanQueryLoadContext context = this.getSource().createContext();
try
{
return this.getLoad(context) / this.getCapacity();
}
finally
{
context.close();
}
}
}{code}
Now use the new load metric impl and mbean interface in your *-jboss-beans.xml config:
{code:xml}<bean name="BusyConnectorsLoadMetric" class="org.jboss.modcluster.load.metric.impl.MyBusyConnectorsLoadMetric" mode="On Demand">
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.web:service=BusyConnectorsLoadMetric",exposedInterface=org.jboss.modcluster.load.metric.MyLoadMetricMBean.class)</annotation>
</bean>{code}
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
michaelneale Feb 15, 2010 12:21 AM (in response to pferraro)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
pferraro Feb 17, 2010 3:10 PM (in response to michaelneale)It looks like Jopr uses the same JMX-based mechanism as mod_cluster to detect connector thread busyness:
http://www.jopr.org/display/JOPR2/Tomcat+Connector+Service
BTW - I've created a feature request for this topic: