From version < 17.1 >
edited by Silvia Macovei
on 2012/03/13
To version < 17.2 >
edited by Silvia Macovei
on 2012/03/19
< >
Change comment: Used image macro

Summary

Details

Page properties
Content
... ... @@ -77,11 +77,11 @@
77 77  
78 78  Example showing all JBoss Caches in memory in a running instance, showing all the elements in the cache (example on the document cache):
79 79  
80 -[[image:jbosscache.png||style="border:1px solid silver"]]
80 +{{image reference="jbosscache.png"/}}
81 81  
82 82  Example showing Cache stats (for the document cache):
83 83  
84 -[[image:jbosscache-stats.png||style="border:1px solid silver"]]
84 +{{image reference="jbosscache-stats.png"/}}
85 85  
86 86  == Velocity Cache Monitoring ==
87 87  
... ... @@ -89,15 +89,15 @@
89 89  
90 90  JConsole examples showing the Velocity Cache monitoring:
91 91  
92 -[[image:jconsole1.png||style="border:1px solid silver"]]
92 +{{image reference="jconsole1.png"/}}
93 93  
94 -[[image:jconsole2.png||style="border:1px solid silver"]]
94 +{{image reference="jconsole2.png"/}}
95 95  
96 96  == JGroups Monitoring ==
97 97  
98 98  JConsole example showing the JGroups monitoring:
99 99  
100 -[[image:jgroups.png||style="border:1px solid silver"]]
100 +{{image reference="jgroups.png"/}}
101 101  
102 102  Interesting things to do on JGroups in the JMX console:
103 103  * Change the log level on the protocols to enable logging
... ... @@ -107,7 +107,7 @@
107 107  
108 108  JConsole example showing how to modify the logging level for a category:
109 109  
110 -[[image:jmx-logging.png||style="border:1px solid silver"]]
110 +{{image reference="jmx-logging.png"/}}
111 111  
112 112  = Tomcat JMX Proxy Servlet =
113 113  

There are various solutions you can use to monitor a running XWiki instance:

  • Install and configure JavaMelody
  • Use a Profiler. This has the advantage of providing advanced information, but has the drawback of being resource intensive and thus slowing the XWiki instance. It also requires a special startup script.
  • Starting with XWiki Enterprise 2.4M2 we're now using the JMX Technology to provide runtime monitoring of XWiki instances. The following features are currently available:
    • Monitor the Velocity macro caches
    • Monitor the JBossCache caches XWiki is using to cache Document data, Users & Groups data and more
    • (starting with XE 3.1) Monitor the JGroups channel and protocols (when the XWiki Cluster feature is turned on)
    • (starting with XE 3.1) Monitor the Logback Logging configuration and change it

XWiki also has a Monitor Plugin that you can use to monitor execution times. However this plugin is going to be deprecated in the future and replaced by the JMX technology.

JavaMelody

http://javamelody.googlecode.com/svn/trunk/javamelody-core/src/site/resources/screenshots/graphs.png

To install JavaMelody for XWiki follow these steps (see the JavaMelody user guide for more details):

  • Download the latest javamelody.jar and jrobin-x.jar and put them in WEB-INF/lib
  • Edit web.xml and add the following information:
    ...

     monitoring
     net.bull.javamelody.MonitoringFilter

    ... other s from the default web.xml here ...


     monitoring
     /*

    ... other s from the default web.xml here ...


     net.bull.javamelody.SessionListener

    ... other s from the default web.xml here ...
    ...
  • Edit hibernate.cfg.xml and add:
    name="jdbc.factory_class">net.bull.javamelody.HibernateBatcherFactory

Then restart XWiki and access JavaMelody at http://localhost:8080/xwiki/monitoring.

JMX Console

Since JMX is a standard you can use any JMX-compatible monitoring console (most application servers provide a web-based JMX console). There's also such a console called JConsole and which is bundled by default in the Java Runtime you're using. To start it, simply execute the jconsole executable.

XWiki Caches Monitoring

XWiki can use different cache implementations. The JBoss Cache and JBoss Infinispan implementations have nice JMX features available as shown below.

Since XWiki 3.3 the default implementation is JBoss Infinispan.

With JBoss Infinispan

Since JBoss Infinispan natively supports JMX we benefit from this feature directly (JBoss documentation available here).

Prior to XWiki Enterprise 3.5 the JMX support was not enabled by default. To enable it, edit WEB-INF/cache/infinispan/config.xml and uncomment the two places where the "jmx" string is mentioned

Example showing the cache list and some statistic for a given cache:

infinispancache.png

With JBoss Cache

Since JBoss Cache natively supports JMX we benefit from this feature directly (JBoss documentation available here).

Example showing all JBoss Caches in memory in a running instance, showing all the elements in the cache (example on the document cache):

jbosscache.png

jbosscache.png

Example showing Cache stats (for the document cache):

jbosscache-stats.png

jbosscache-stats.png

Velocity Cache Monitoring

Velocity caches Velocity macros. XWiki offers a JMX view of the content of the Velocity caches.

JConsole examples showing the Velocity Cache monitoring:

jconsole1.png

jconsole1.png

jconsole2.png

jconsole2.png

JGroups Monitoring

JConsole example showing the JGroups monitoring:

jgroups.png

jgroups.png

Interesting things to do on JGroups in the JMX console:

  • Change the log level on the protocols to enable logging
  • Disconnect a node from the cluster and reconnect it

Logback Monitoring

JConsole example showing how to modify the logging level for a category:

jmx-logging.png

jmx-logging.png

Tomcat JMX Proxy Servlet

Tomcat has a JMX Proxy Servlet bundled in their manager webapp (see here and here for more details on Tomcat and JMX]].

Here's some useful URLs to use the JMX Servlet Proxy to list and set JGroups Protocol Levels:

  • To display the current log level for the TCPPING protocol: http://localhost:8080/manager/jmxproxy?qry=jgroups:type=protocol,cluster=event,protocol=TCPPING
  • To set the log level to info for the TCPPING protocol: http://localhost:8080/manager/jmxproxy?set=jgroups:type=protocol,cluster=event,protocol=TCPPING&att=Level&val=info

Using Groovy

It's possible to write a Groovy script in a wiki page to access the JMX MBeans.

Get Connected