cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > JMX Management
Date Fri, 02 Sep 2011 15:26:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JMX+Management">JMX
Management</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~mazzag">Glen
Mazza</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        Updated JConsole information.<br />
    </div>
        <br/>
                         <h4>Changes (12)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h1. Configuring JMX Integration <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >To enable <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">the</span>
JMX integration, register an InstrumentationManager extension with the CXF bus.  Using Spring
<span class="diff-changed-words">XML<span class="diff-added-chars"style="background-color:
#dfd;"> on Tomcat</span>,</span> the following minimal XML snippet will enable
JMX integration. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:xml} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">&lt;import
resource=&quot;classpath:META-INF/cxf/cxf.xml&quot;/&gt; <br>... <br>
<br></td></tr>
            <tr><td class="diff-unchanged" >&lt;bean id=&quot;org.apache.cxf.management.InstrumentationManager&quot;
<br>  class=&quot;org.apache.cxf.management.jmx.InstrumentationManagerImpl&quot;&gt;
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">
 &lt;property name=&quot;bus&quot; ref=&quot;cxf&quot; /&gt; <br></td></tr>
            <tr><td class="diff-unchanged" >  &lt;property name=&quot;enabled&quot;
value=&quot;true&quot; /&gt; <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
 &lt;property name=&quot;bus&quot; ref=&quot;cxf&quot; /&gt; <br>
 &lt;property name=&quot;usePlatformMBeanServer&quot; value=&quot;true&quot;
/&gt; <br></td></tr>
            <tr><td class="diff-unchanged" >&lt;/bean&gt; <br>{code}
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >| 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 | <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">To
avoid any unnecessary runtime overhead, the performance counters measuring response time are
disabled by default. Further [configuration|#response_time] is required to enable this instrumentation.
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">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|#response_time]
is required -- these are disabled by default to avoid unnecessary runtime overhead. <br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >To test the configuration start
up your service and connect to it by using <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">jconsole</span>
<span class="diff-added-words"style="background-color: #dfd;">JConsole</span>
from the JDK. <br></td></tr>
            <tr><td class="diff-unchanged" >!jconsole_connect2.png! <br>&amp;nbsp;
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{anchor:response_time}
 <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h1.
How to Get the Request/Response Handling Time? <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h1.
How to get web service performance metrics (Request/Response time, number of calls, etc.)?
<br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >The CXF management module also
provides a feature <span class="diff-added-words"style="background-color: #dfd;">(the
Performance.Counter.Server MBean)</span> which <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">can
get the</span> <span class="diff-added-words"style="background-color: #dfd;">provides</span>
aggregate statistics for services running in the CXF Bus. <span class="diff-added-words"style="background-color:
#dfd;"> It is not enabled by default to avoid unnecessary runtime overhead during web service
call processing.</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >Here is the configuration snippet
that you should add to your Spring context file to <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">enable
response time collection.</span> <span class="diff-added-words"style="background-color:
#dfd;">be able to view this information:</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:xml} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >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. <span class="diff-added-words"style="background-color: #dfd;"> Note a SOAP call
will need to occur against the web service before you will see the MBean within your JMX monitoring
software.</span> <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="JMXManagement-ConfiguringJMXIntegration"></a>Configuring
JMX Integration</h1>

<p>To enable JMX integration, register an InstrumentationManager extension with the
CXF bus.  Using Spring XML on Tomcat, the following minimal XML snippet will enable JMX integration.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;import resource=<span class="code-quote">"classpath:META-INF/cxf/cxf.xml"</span>/&gt;</span>
...

&lt;bean id=<span class="code-quote">"org.apache.cxf.management.InstrumentationManager"</span>
  class=<span class="code-quote">"org.apache.cxf.management.jmx.InstrumentationManagerImpl"</span>&gt;
  <span class="code-tag">&lt;property name=<span class="code-quote">"enabled"</span>
value=<span class="code-quote">"true"</span> /&gt;</span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"bus"</span>
ref=<span class="code-quote">"cxf"</span> /&gt;</span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"usePlatformMBeanServer"</span>
value=<span class="code-quote">"true"</span> /&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span>
</pre>
</div></div>

<p>The default InstrumentationManager accepts the following configuration options:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Value </th>
<th class='confluenceTh'> Default </th>
</tr>
<tr>
<td class='confluenceTd'> enabled </td>
<td class='confluenceTd'> If the JMX integration should be enabled or not </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> bus </td>
<td class='confluenceTd'> The CXF bus instance to register the JMX extension with </td>
<td class='confluenceTd'> None </td>
</tr>
<tr>
<td class='confluenceTd'> server </td>
<td class='confluenceTd'> 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. </td>
<td class='confluenceTd'> None </td>
</tr>
<tr>
<td class='confluenceTd'> usePlatformMBeanServer </td>
<td class='confluenceTd'> If true and no reference to an MBeanServer is supplied, the
JMX extension registers MBeans with the platform MBean server. </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> serverName </td>
<td class='confluenceTd'> 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. </td>
<td class='confluenceTd'> None </td>
</tr>
<tr>
<td class='confluenceTd'> createMBServerConnectorFactory </td>
<td class='confluenceTd'> If true, a connector is created on the MBeanServer. </td>
<td class='confluenceTd'> true </td>
</tr>
<tr>
<td class='confluenceTd'> threaded </td>
<td class='confluenceTd'> Determines if the creation of the MBean connector is performed
in this thread or in a separate thread.  Only relevant if createMBServerConnectorFactory is
true. </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> daemon </td>
<td class='confluenceTd'> Determines if the MBean connector creation thread is marked
as a daemon thread or not.  Only relevant if createMBServerConnectorFactory is true. </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> JMXServiceURL </td>
<td class='confluenceTd'> The URL of the connector to create on the MBeanServer.   
Only relevant if createMBServerConnectorFactory is true. </td>
<td class='confluenceTd'> service:jmx:rmi:///jndi/rmi://localhost:9913/jmxrmi </td>
</tr>
</tbody></table>
</div>


<p>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 <a href="#JMXManagement-responsetime">configuration</a>
is required &#8211; these are disabled by default to avoid unnecessary runtime overhead.</p>


<h2><a name="JMXManagement-ExampleConfiguration"></a>Example Configuration</h2>

<p>Enable JMX integration by adding the following XML to your CXF Spring context.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;bean id=<span class="code-quote">"org.apache.cxf.management.InstrumentationManager"</span>
  class=<span class="code-quote">"org.apache.cxf.management.jmx.InstrumentationManagerImpl"</span>&gt;
  <span class="code-tag">&lt;property name=<span class="code-quote">"bus"</span>
ref=<span class="code-quote">"cxf"</span> /&gt;</span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"enabled"</span>
value=<span class="code-quote">"true"</span> /&gt;</span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"JMXServiceURL
"</span> value=<span class="code-quote">"service:jmx:rmi:///jndi/rmi://localhost:9914/jmxrmi"</span>
/&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span>
</pre>
</div></div>

<p>To test the configuration start up your service and connect to it by using JConsole
from the JDK.<br/>
<span class="image-wrap" style=""><img src="/confluence/download/attachments/70534/jconsole_connect2.png?version=1&amp;modificationDate=1194675533000"
style="border: 0px solid black" /></span><br/>
&nbsp;<br/>
Then you can browse to your endpoint:<br/>
&nbsp;<br/>
<span class="image-wrap" style=""><img src="/confluence/download/attachments/70534/jconsole_service_endpoint.png?version=1&amp;modificationDate=1194675339000"
style="border: 0px solid black" /></span><br/>
&nbsp;</p>

<p><a name="JMXManagement-cxfinservicemix"></a></p>
<h1><a name="JMXManagement-ConfiguringCXFtoUsetheServiceMix4MBeanServer"></a>Configuring
CXF to Use the ServiceMix 4 MBeanServer</h1>

<p>If you are embedding a CXF service in a ServiceMix 4 container, the configuration
is slightly different from above. You don't want to start a new MBeanServer and you probably
don't want to create additional connectors as the container manages both of these for you.
 You can get a reference to the container's MBeanServer through the OSGi framework and inject
this reference into the JMX integration extension. Don't forget to add the Spring OSGI namespace
and schemaLocation to your CXF configuration file if they are not already present.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag"><span class="code-comment">&lt;!-- OSGi namespace and
schemaLocation required --&gt;</span></span>
&lt;beans ...
       <span class="code-keyword">xmlns:osgi</span>=<span class="code-quote">"http://www.springframework.org/schema/osgi"</span>
       ...      
       xsi:schemaLocation="...
       http://www.springframework.org/schema/osgi  http://www.springframework.org/schema/osgi/spring-osgi.xsd"&gt;

...

<span class="code-tag"><span class="code-comment">&lt;!-- Grab a reference
to the current MBeanServer --&gt;</span></span>
<span class="code-tag">&lt;osgi:reference id=<span class="code-quote">"mbeanServer"</span>
interface=<span class="code-quote">"javax.management.MBeanServer"</span> cardinality=<span
class="code-quote">"0..1"</span>/&gt;</span>

&lt;bean id=<span class="code-quote">"org.apache.cxf.management.InstrumentationManager"</span>
  class=<span class="code-quote">"org.apache.cxf.management.jmx.InstrumentationManagerImpl"</span>&gt;
  <span class="code-tag">&lt;property name=<span class="code-quote">"bus"</span>
ref=<span class="code-quote">"cxf"</span> /&gt;</span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"enabled"</span>
value=<span class="code-quote">"true"</span> /&gt;</span>
  <span class="code-tag"><span class="code-comment">&lt;!-- Unless you really
want to open an additional connector, set this to false --&gt;</span></span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"createMBServerConnectorFactory
"</span> value=<span class="code-quote">"false"</span> /&gt;</span>

  <span class="code-tag"><span class="code-comment">&lt;!-- Inject the reference
to the MBeanServer --&gt;</span></span>
  <span class="code-tag">&lt;property name=<span class="code-quote">"server"</span>
ref=<span class="code-quote">"mbeanServer"</span> /&gt;</span> 
<span class="code-tag">&lt;/bean&gt;</span>
</pre>
</div></div>

<p><a name="JMXManagement-responsetime"></a> </p>
<h1><a name="JMXManagement-Howtogetwebserviceperformancemetrics%28Request%2FResponsetime%2Cnumberofcalls%2Cetc.%29%3F"></a>How
to get web service performance metrics (Request/Response time, number of calls, etc.)?</h1>

<p>The CXF management module also provides a feature (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.</p>

<p>Here is the configuration snippet that you should add to your Spring context file
to be able to view this information:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
    <span class="code-tag"><span class="code-comment">&lt;!-- Wiring the counter
repository --&gt;</span></span> 
    <span class="code-tag">&lt;bean id=<span class="code-quote">"CounterRepository"</span>
class=<span class="code-quote">"org.apache.cxf.management.counters.CounterRepository"</span>&gt;</span>
        <span class="code-tag">&lt;property name=<span class="code-quote">"bus"</span>
ref=<span class="code-quote">"cxf"</span> /&gt;</span>        
    <span class="code-tag">&lt;/bean&gt;</span>
</pre>
</div></div>

<p>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.</p>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JMX+Management">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=70534&revisedVersion=13&originalVersion=12">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JMX+Management?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message