Configuring JMX Integration
To enable the JMX integration, register an InstrumentationManager extension with the CXF bus. Using Spring XML on Tomcat, the following minimal XML snippet will enable JMX integration.
Code Block | ||||
---|---|---|---|---|
| ||||
<import resource="classpath:META-INF/cxf/cxf.xml"/> ... <bean id="org.apache.cxf.management.InstrumentationManager" class="org.apache.cxf.management.jmx.InstrumentationManagerImpl"> <property name="enabled" value="true" /> <property name="bus" ref="cxf" /> <property name="enabledusePlatformMBeanServer" value="true" /> </bean> |
...
Name | Value | Default |
---|---|---|
enabled | If the JMX integration should be enabled or not | false |
bus | The CXF bus instance to register the JMX extension with | None |
server | An optional reference to an MBeanServer instance to register MBeans with. If not supplied, an MBeanServer is resolved using the "usePlatformMBeanServer" and/or "serverName" optoins. | None |
usePlatformMBeanServer | If true and no reference to an MBeanServer is supplied, the JMX extension registers MBeans with the platform MBean server. | false |
serverName | If supplied, usePlatformMBeanServer is false, and no reference to an MBeanServer is supplied, the JMX extension registers MBeans with the MBean server carrying this name. | None |
createMBServerConnectorFactory | If true, a connector is created on the MBeanServer. | true |
threaded | Determines if the creation of the MBean connector is performed in this thread or in a separate thread. Only relevant if createMBServerConnectorFactory is true. | false |
daemon | Determines if the MBean connector creation thread is marked as a daemon thread or not. Only relevant if createMBServerConnectorFactory is true. | false |
JMXServiceURL | The URL of the connector to create on the MBeanServer. Only relevant if createMBServerConnectorFactory is true. | service:jmx:rmi:///jndi/rmi://localhost:9913/jmxrmi |
To avoid any unnecessary runtime overhead, the performance counters measuring response time The MBean instrumentation provided by the above configuration will provide generic information about the WSDL supported by the web service as well as web service administration commands. To see performance metrics of the SOAP call processing, further configuration is required – these are disabled by default . Further configuration is required to enable this instrumentationto avoid unnecessary runtime overhead.
Example Configuration
Enable JMX integration by adding the following XML to your CXF Spring context.
...
To test the configuration start up your service and connect to it by using jconsole JConsole from the JDK.
Then you can browse to your endpoint:
...
Anchor | ||||
---|---|---|---|---|
|
How to
...
get web service performance metrics (Request/Response
...
time, number of calls, etc.)?
The CXF management module also provides a feature which can get the (the Performance.Counter.Server MBean) which provides aggregate statistics for services running in the CXF Bus. It is not enabled by default to avoid unnecessary runtime overhead during web service call processing.
Here is the configuration snippet that you should add to your Spring context file to enable response time collection.to be able to view this information:
Code Block | ||||
---|---|---|---|---|
| ||||
<!-- Wiring the counter repository --> <bean id="CounterRepository" class="org.apache.cxf.management.counters.CounterRepository"> <property name="bus" ref="cxf" /> </bean> |
The CounterRepository collects the following metrics: invocations, checked application faults, unchecked application faults, runtime faults, logical runtime faults, total handling time, max handling time, and min handling time. Note a SOAP call will need to occur against the web service before you will see the MBean within your JMX monitoring software.