March 16, 2011 Leave a comment
One of the latest feature that I’ve implemented into Jabberwocky container are packet statstics. The statistics are published through Glassfish’s JMX framework. There are global packet statistics viz. the number of packets that the container has send/received and also per component/application statistics which is a subset of the global. Lets see how this works.
Get the latest bundle here. Download Jabberwocky XMPP container – GF 3.1. This version now supports the latest Glassfish 3.1 only and will not work on 3.0.x. Unzip and install. One thing to note, the OSGi console is not installed with 3.1. So the way to verify that you have installed correctly, start the domain and run any xmpp command like so
asadmin start-domain –domaindir /my/domain/dir mydomain
There are no XMPP components deployed
Command list-xmpp-components executed successfully.
Since the statistics are published via JMX, we need to use a JMX monitoring client. If you are using JDK6, there is jvisualvm bundled with it. There is also visualvm which is the opensource version of jvisualvm. I’ll be using visualvm but the steps for jvisualvm are identical. You can use any JMX client including the older jconsole.
Whether you are using jvisualvm or visualvm, you first need to install a plugin to allow you to see the MBeans in Glassfish. Start visualvm (or jvisualvm), select Tools (from the menu bar) | Plugins | Available Plugins tab. Look for VisualVM-MBeans plugin, select and install. You will need to be connected to the Internet to perform this.
Once you have successfully installed the plugin, double click on the Glassfish icon to open its instrumentation tab. Now click on the MBeans tab to the right. You should now see something similar to the below diagram
You will now need to start JMX in Glassfish. Expand amx-support and select boot-amx. Now select Operations tab. You should now see the bootAMX button. Click on that to start JMX.
A new node call amx will now appear above amx-support.
Enabling Jabberwocky Container Statistics
By default JMX is disable for all containers/modules. We need to now enable monitoring for Jabberwocky. Expand amx, look for container-monitoring node. Continue to click into all node in container-monitoring until you see xmpp-container. Select the xmpp-container node. Now select Attributes tab from the right side panel. The default setting for Jabberwocky container is OFF.
Double click on OFF and change that to HIGH to turn on statistics collection. Glassfish will remember this setting across reboots so you will only need to do this once.
The JMX module in Jabberwocky is lazily loaded viz. it will not load if there are no activity to the container even though it is enabled. To coax it to load, execute any Jabberwocky command eg list-xmpp-components from the above example. Once you have done that you will notice two additional nodes appearing under amx. These two nodes are xmpp-incoming-packet-mon and xmpp-outgoing-packet-mon.; they represent incoming and outgoing XMPP packets respectively. Expand these nodes until you come across xmpp-container/incoming and xmpp-container/outgoing. These nodes contains detail statistics on each type of incoming and outgoing packets; by clicking on them, the detail packet statistics will be displayed. See the following image.
The attributes have the following meaning
|incomingiqerrorpacketcount||Inbound IQ error packets for container|
|incomingiqgetpacketcount||Inbound IQ get packets for container|
|incomingiqresultpacketcount||Inbound IQ result packets for container|
|incomingiqsetpacketcount||Inbound IQ set packets for container|
|incomingmessagepacketcount||Inbound Message packets for container|
|incomingpresencepacketcount||Inbound Presence packets for container|
|outgoingiqerrorpacketcount||Outbound IQ error packets for container|
|outgoingiqgetpacketcount||Outbound IQ get packets for container|
|outgoingiqresultpacketcount||Outbound IQ result packets for container|
|outgoingiqsetpacketcount||Outbound IQ set packets for container|
|outgoingmessagepacketcount||Outbound Message packets for container|
|outgoingpresencepacketcount||Outbound Presence packets for container|
To view any one of these statistics, double click on the Value column. This will expand the Value cell as shown in the diagram below
count gives the total count of all incoming XMPP Message into the container.
Jabberwocky also keeps track of per application statistics. The statistics are kept under the application’s namespace. For example if you deploy an application like so
asadmin deploy uppercase.xar
then there will be two additional nodes called xmpp-container/uppercase/incoming and xmpp-container/uppercase/outgoing. See the following diagram
One final note, the Glassfish and visualvm used in this blog runs on JDK6u20 and above.
Thanks to Jennifer Chou from the Glassfish team who helped me with some of the some of the bugs in my code.
Till next time.