WSO2 ESB provides a variety of options to monitor and manage the server runtime, through a number of monitoring tools in its Management Console as well as JMX-based (Java Management Extensions) monitoring. Results provided by these convenient, yet powerful ESB monitoring mechanisms can be used to tune message flows, detect mediation faults and track usage patterns.
The following topics investigate how to monitor WSO2 ESB using Mediation Statistics component and Java Management Extensions (JMX).
Mediation statistics are widely-used monitoring features. From functional components of the ESB, sequences, proxy services and endpoints directly get involved in processing messages. The Mediation Statistics feature enables a server administrator to collect runtime statistical information on these three types of functional components and view them through the Management Console. This feature provides a simple but effective way of determining the runtime performance of the ESB. The collected statistical data can be used to analyze network traffic patterns and draw rough estimates on how the service bus will be used in the future. Perhaps the most enticing attribute of the mediation statistics feature is that it can be configured in a fine grained manner. In other words, it allows a user to collect data on only a specified set of sequences, proxy services and endpoints.
Mediation Statistics component of WSO2 ESB uses an in-memory data store to keep the collected data. The memory usage of the data store is restricted by the total number of statistics collecting proxy services, sequences and endpoints. If the number of proxy services, sequences and endpoints is constant, the memory usage of the mediation statistics component stays constant. Mediation Statistics component also supports persistence as an optional feature. That is, one may configure the ESB to save statistics to the WSO2 Governance Registry instance that comes embedded with the ESB. Mediation Statistics API allows easy sharing of collected data, among Carbon components. Currently WSO2 Business Activity Monitor (BAM) makes use of this API to access data collected by the service bus. Users can also develop custom data consumers to retrieve mediation statistics from the in-memory data store and process them further, using this API.
Mediation Statistics feature is available with WSO2 ESB out of the box. You do not have to configure anything to use this feature. Simply sign-in to the Management Console and enable statistics on the sequences, proxy services and endpoints you want to monitor, and the service bus will start collecting data on them. For an example, in order to enable statistics for a sequence, click on Service Bus > Sequences in the left menu and simply click on the Enable Statistics icon corresponding to that sequence.
To enable statistics for a mediation component using the Synapse configuration language, set the value of the "statistics" attribute to "enabled" on the sequence, proxy or endpoint configuration.
To view the gathered statistics, click Monitor > Mediation Statistics. You will be shown a graphical summary of all collected statistics.
Starting from this view, you can drill down to see more fine grained data such as statistics pertaining to a single sequence or a proxy service. You can even get statistics for different operations on the same endpoint. Click Proxy Service Statistics link in the upper right corner box of the UI shown above to view a summary of Proxy Service Statistics as follows:
Select a proxy service from the "Proxy Services" list shown above to view statistics of that proxy service.
WSO2 ESB Management Console provides ways to monitor System Statistics , Transport Statistics and System Logs . SOAP Tracer and Mediation Tracer are some additional monitoring tools provided by WSO2 ESB.
WSO2 ESB exposes number of management resources as JMX MBeans that can be used for managing and monitoring the running server. These MBeans can be accessed remotely using a JMX client such as JConsole. When WSO2 ESB is starting up, it will display the JMX Service URL in the console as follows.
This URL can be used to remotely access the JMX Service exposed by WSO2 ESB. In this guide, we will use JConsole as the JMX client to access this service.
Start JConsole and enter the above URL as the JMX Service URL. Type "admin" in both username and password fields and click "Connect".
After successfully connecting to the JMX service, click on "MBeans" tab of JConsole to view MBeans exposed by the ESB. As shown in Figure 6, these are listed under org.apache.axis2 and org.apache.synapse nodes. The following section summarizes the attributes and operations available in MBeans exposed by the WSO2 ESB.
Transport related MBeans: For each transport listener and sender enabled in the ESB, there will be an MBean under org.apache.axis2/Transport node which has following attributes and operations. For example, when http and https transports are enabled following MBeans will be exposed.
|ActiveThreadCount||Threads active in this transport listener/sender.|
|AvgSizeReceived||Average size of received messages.|
|AvgSizeSent||Average size of sent messages.|
|MaxSizeReceived||Maximum message size of received messages.|
|MaxSizeSent||Maximum message size of sent messages.|
|MinSizeReceived||Minimum message size of received messages.|
|MinSizeSent||Minimum message size of sent messages.|
|MessagesReceived||Total number of messages received through this transport.|
|MessagesSent||Total number of messages sent through this transport.|
|FaultsReceiving||Number of faults encountered while receiving.|
|FaultsSending||Number of faults encountered while sending.|
|BytesReceived||Number of bytes received through this transport.|
|BytesSent||Number of bytes sent through this transport.|
|QueueSize||Number of messages currently queued. Messages get queued if all the worker threads in this transport thread pool are busy.|
|ResponseCodeTable||Number of messages sent against their response codes.|
|TimeoutsReceiving||Message receiving timeout.|
|TimeoutsSending||Message sending timeout.|
|LastResetTime||Last time transport listener/sender statistic recording was reset.|
|MetricsWindow||Time difference between current time and last reset time in milliseconds.|
|resetStatistics()||Clear recorded transport listener/sender statistics and restart recording.|
|start()||Start this transport listener/sender.|
|stop()||Stop this transport listener/sender.|
|pause()||Pause this transport listener/sender which has been started.|
|resume()||Resume this transport listener/sender which is currently paused.|
|maintenenceShutdown(long gracePeriod)||Stop processing new messages, and wait the specified maximum time for in-flight requests to complete before a controlled shutdown for maintenence.|
Latency related MBeans:
|AllTimeAvgLatency||Average latency since latency recording was last reset.|
|LastXxxAvgLatency||Average latency for last Xxx time period. For example, LastHourAvgLatency return the average latency for last hour.|
|LastResetTime||Last time latency statistic recording was reset.|
|reset()||Clear recorded latency statistics and restart recording.|
NttpConnections related MBeans:
|ActiveConnections||Number of currently active connections.|
|ActiveConnectionsPerHosts||A map of number of connections against hosts.|
|LastXxxConnections||Number of connections created during last Xxx time period.|
|RequestSizesMap||A map of number of requests against their sizes.|
|ResponseSizesMap||A map of number of responses against their sizes.|
|LastResetTime||Last time connection statistic recordings was reset.|
|reset()||Clear recorded connection statistics and restart recording.|
Threading related MBeans:
|TotalWorkerCount||Total worker threads related to this server/client.|
|AvgUnblockedWorkerPercentage||Time-averaged unblocked worker thread percentage.|
|AvgBlockedWorkerPercentage||Time-averaged blocked worker thread percentage.|
|LastXxxBlockedWorkerPercentage||Blocked worker thread percentage averaged for last Xxx time period.|
|DeadLockedWorkers||Number of deadlocked worker threads since last statistics reset.|
|LastResetTime||Last time thread statistic recordings was reset.|
|reset()||Clear recorded thread statistic and restart recording.|
Simple Network Management Protocol (SNMP) is an Internet-standard protocol for managing devices on IP networks. Given below is how to configure SNMP in WSO2 ESB, which exposes various MBeans via SNMP.
1. Download the following jar files from http://www.snmp4j.org and add to <carbon_home>/repository/components/lib.
3. This enabled the ESB server to monitor MBeans with SNMP. For example: