Hide last authors
Vincent Massol 6.1 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
Vincent Massol 13.2 5 There are various solutions you can use to monitor a running XWiki instance:
Ecaterina Moraru (Valica) 26.1 6
Thomas Mortagne 29.1 7 * Install and configure [[Glowroot>>https://glowroot.org]]
Maxime Sinclair 24.2 8 * Install and configure [[JavaMelody>>https://github.com/javamelody/javamelody/wiki]]
Ecaterina Moraru (Valica) 26.1 9 * [[Use a Profiler>>dev:Community.Profiling]]. 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.
10 * Starting with XWiki 2.4M2 we're now using the [[JMX Technology>>http://en.wikipedia.org/wiki/Java_Management_Extensions]] to provide runtime monitoring of XWiki instances. The following features are currently available:
Vincent Massol 31.2 11 ** Monitor the InfiniSpan caches XWiki is using to cache Document data, Users & Groups data and more
12 ** Monitor the JGroups channel and protocols (when the XWiki Cluster feature is turned on)
13 ** Monitor the Logback Logging configuration and change it
14 ** Monitor Solr cores
Vincent Massol 1.1 15
Vincent Massol 2.3 16 {{info}}
Ecaterina Moraru (Valica) 26.4 17 XWiki also has a [[Monitor Plugin>>Documentation.AdminGuide.Logging||anchor="HActivatingtheXWikiMonitoringfeature"]] 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.
Vincent Massol 2.3 18 {{/info}}
19
Thomas Mortagne 29.1 20 = Glowroot =
21
Vincent Massol 30.2 22 {{image reference="glowroot.png" width="650px"/}}
Thomas Mortagne 29.1 23
24 There is nothing specific about XWiki when you install Glowroot, just follow [[the standard documentation>>https://github.com/glowroot/glowroot/wiki/Agent-Installation-%28with-Embedded-Collector%29]].
25
Vincent Massol 13.2 26 = JavaMelody =
27
Vincent Massol 24.3 28 [[[[image:https://raw.githubusercontent.com/wiki/javamelody/javamelody/resources/screenshots/graphs.png||width="50%"]]>>https://github.com/javamelody/javamelody/wiki/Screenshots#charts||style="width:50%"]]
Vincent Massol 13.2 29
Maxime Sinclair 24.2 30 To install JavaMelody for XWiki follow these steps (see the [[JavaMelody user guide>>https://github.com/javamelody/javamelody/wiki/UserGuide]] for more details):
Ecaterina Moraru (Valica) 26.1 31
Maxime Sinclair 24.2 32 * Download the latest [[javamelody.jar>>https://github.com/javamelody/javamelody/releases]] and [[jrobin-x.jar>>https://github.com/javamelody/javamelody/releases/download/javamelody-core-1.49.0/jrobin-1.5.9.jar]] and put them in the ##WEB-INF/lib## folder
Vincent Massol 13.2 33 * Edit ##web.xml## and add the following information:(((
34 {{code}}
35 ...
36 <filter>
37 <filter-name>monitoring</filter-name>
38 <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
39 </filter>
Pascal Bastien 25.1 40 <!-- to enable BASIC authentication with username and password, but do no want to use a realm and "security-constraint"
Pascal Bastien 28.1 41 The storage files of statistics and of graphs are stored in the temporary directory of the server, unless if you have defined the "storage-directory" path
Pascal Bastien 25.1 42 <filter>
43 <filter-name>javamelody</filter-name>
44 <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
45 <init-param>
46 <param-name>authorized-users</param-name>
47 <param-value>user1:pwd1, user2:pwd2</param-value>
48 </init-param>
Pascal Bastien 28.1 49 <init-param>
50 <param-name>storage-directory</param-name>
51 <param-value>/path/of/javamelody/stats</param-value>
52 </init-param>
Pascal Bastien 25.1 53 </filter> -->
Vincent Massol 13.2 54 ... other <filter>s from the default web.xml here ...
55
56 <filter-mapping>
57 <filter-name>monitoring</filter-name>
58 <url-pattern>/*</url-pattern>
59 </filter-mapping>
60 ... other <filter-mapping>s from the default web.xml here ...
61
62 <listener>
63 <listener-class>net.bull.javamelody.SessionListener</listener-class>
64 </listener>
65 ... other <listener>s from the default web.xml here ...
66 ...
67 {{/code}}
68 )))
69 * Edit ##hibernate.cfg.xml## and add:(((
70 {{code}}
71 <property name="jdbc.factory_class">net.bull.javamelody.HibernateBatcherFactory</property>
72 {{/code}}
73 )))
74
Ecaterina Moraru (Valica) 26.1 75 Then restart XWiki and access JavaMelody at ##http:~/~/localhost:8080/xwiki/monitoring##.
Vincent Massol 13.2 76
Denis Gervalle 27.1 77 {{warning}}
78 Recent versions of JavaMelody (at least 1.70+ ?) require the configuration in this guide to be adapted like this:
79
80 {{code}}
81 in web.xml:
82 -----------
83
84 <filter>
85 <filter-name>javamelody</filter-name>
86 <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
87 <async-supported>true</async-supported>
88 </filter>
89 <filter-mapping>
90 <filter-name>javamelody</filter-name>
91 <url-pattern>/*</url-pattern>
92 <dispatcher>REQUEST</dispatcher>
93 <dispatcher>ASYNC</dispatcher>
94 </filter-mapping>
95 <listener>
96 <listener-class>net.bull.javamelody.SessionListener</listener-class>
97 </listener>
98
99
100
101 in hibernate.cfg.xml:
102 ---------------------
103
104 <property name="connection.driver_class">net.bull.javamelody.JdbcDriver</property>
105 <property name="connection.driver">com.mysql.jdbc.Driver</property>
106 {{/code}}
107 {{/warning}}
108
Vincent Massol 1.1 109 = JMX Console =
110
Manuel Smeria 17.3 111 Since JMX is a standard you can use [[any JMX-compatible monitoring console>>http://stackoverflow.com/questions/1744900/what-is-the-best-or-most-commonly-used-jmx-console-client]] (most application servers provide a web-based JMX console). There's also a console called [[JConsole>>http://docs.oracle.com/javase/7/docs/technotes/guides/management/jconsole.html]] which is bundled by default in the Java Runtime you're using. To start it, simply execute the ##jconsole## executable.
Vincent Massol 1.1 112
Vincent Massol 24.1 113 {{info}}
114 Note that starting with XWiki 6.3, if you're using the Standalone Distribution (which bundles Jetty) you can now use ##start_xwiki.sh -j## (or ##start_xwiki.sh ~-~-jmx##) to monitor/manage the Jetty instance itself (it adds Jetty-specific MBeans):
Vincent Massol 22.1 115
Vincent Massol 24.1 116 {{image reference="jettymbeans.png"/}}
117 {{/info}}
118
Vincent Massol 11.1 119 == XWiki Caches Monitoring ==
120
Vincent Massol 14.1 121 XWiki can use different cache implementations. The JBoss Cache and JBoss Infinispan implementations have nice JMX features available as shown below.
Vincent Massol 11.1 122
Manuel Smeria 17.3 123 Starting with XWiki 3.3 the default implementation is JBoss Infinispan.
Vincent Massol 14.1 124
125 === With JBoss Infinispan ===
126
127 Since JBoss Infinispan natively supports JMX we benefit from this feature directly (JBoss documentation available [[here>>https://docs.jboss.org/author/display/ISPN/Management+Tooling]]).
128
Manuel Smeria 17.3 129 {{info}}
Ecaterina Moraru (Valica) 26.1 130 Prior to XWiki 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
Manuel Smeria 17.3 131 {{/info}}
Vincent Massol 14.1 132
133 Example showing the cache list and some statistic for a given cache:
134
Manuel Smeria 17.3 135 {{image reference="infinispancache.png"/}}
Vincent Massol 14.1 136
Vincent Massol 20.1 137 Example showing how to clear a given cache from all its entries:
138
139 {{image reference="infinispancacheclearing.png"/}}
140
Vincent Massol 14.1 141 === With JBoss Cache ===
142
Manuel Smeria 17.3 143 Since JBoss Cache natively supports JMX we benefit from this feature directly (JBoss documentation available [[here>>https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_Web_Platform/5/html/JBoss_Cache_User_Guide/jmx_reference.html]]).
Vincent Massol 14.1 144
Vincent Massol 11.1 145 Example showing all JBoss Caches in memory in a running instance, showing all the elements in the cache (example on the document cache):
146
Silvia Macovei 17.2 147 {{image reference="jbosscache.png"/}}
Vincent Massol 11.1 148
149 Example showing Cache stats (for the document cache):
150
Silvia Macovei 17.2 151 {{image reference="jbosscache-stats.png"/}}
Vincent Massol 11.1 152
Vincent Massol 4.1 153 == Velocity Cache Monitoring ==
Vincent Massol 1.1 154
Vincent Massol 12.2 155 Velocity caches Velocity macros. XWiki offers a JMX view of the content of the Velocity caches.
156
Vincent Massol 4.1 157 JConsole examples showing the Velocity Cache monitoring:
158
Silvia Macovei 17.2 159 {{image reference="jconsole1.png"/}}
Vincent Massol 1.1 160
Silvia Macovei 17.2 161 {{image reference="jconsole2.png"/}}
Vincent Massol 4.1 162
163 == JGroups Monitoring ==
164
165 JConsole example showing the JGroups monitoring:
166
Silvia Macovei 17.2 167 {{image reference="jgroups.png"/}}
Vincent Massol 4.1 168
169 Interesting things to do on JGroups in the JMX console:
Ecaterina Moraru (Valica) 26.1 170
Vincent Massol 4.1 171 * Change the log level on the protocols to enable logging
172 * Disconnect a node from the cluster and reconnect it
Vincent Massol 7.1 173
Vincent Massol 10.1 174 == Logback Monitoring ==
175
176 JConsole example showing how to modify the logging level for a category:
177
Silvia Macovei 17.2 178 {{image reference="jmx-logging.png"/}}
Vincent Massol 10.1 179
Vincent Massol 7.1 180 = Tomcat JMX Proxy Servlet =
181
182 Tomcat has a JMX Proxy Servlet bundled in their ##manager## webapp (see [[here>>http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html]] and [[here>>http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html]] for more details on Tomcat and JMX]].
183
184 Here's some useful URLs to use the JMX Servlet Proxy to list and set JGroups Protocol Levels:
Ecaterina Moraru (Valica) 26.1 185
Vincent Massol 7.1 186 * To display the current log level for the TCPPING protocol: {{{http://localhost:8080/manager/jmxproxy?qry=jgroups:type=protocol,cluster=event,protocol=TCPPING}}}
187 * 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}}}
188
Vincent Massol 18.1 189 = Others =
Vincent Massol 13.1 190
Vincent Massol 28.2 191 * It's possible to [[write a Groovy script in a wiki page to access the JMX MBeans>>snippets:Extension.JMX Access]].
Vincent Massol 18.1 192 * [[JMX Monitoring Application>>extensions:Extension.JMX Monitoring Application]]
Vincent Massol 31.1 193 * [[Clearing Document Caches with JMX>>snippets:Extension.Clear Document Caches.WebHome]]
Vincent Massol 19.1 194 * [[XInit>>extensions:Extension.Xinit]]

Get Connected