Monitor Component Execution Times

Last modified by Eleni Cojocariu on 2026/11/24 18:38

Steps

Record how long XWiki's major components spend on each request, by turning on the Monitor plugin and letting it write its measurements to the log.

  1. Check that the plugin is in the plugin list of WEB-INF/xwiki.cfg. It is in the list XWiki ships, so this is normally already done.
    xwiki.plugins=\
       [...]
       com.xpn.xwiki.monitor.api.MonitorPlugin
  2. Turn the plugin on in the same file. The setting is shipped commented out and defaults to off, so the plugin is loaded but measures nothing until you do this. xwiki.monitor.lastlistsize decides how many recent requests it keeps, and defaults to 20.
    xwiki.monitor=1
  3. Raise the plugin's logger to debug, since that is the level it writes its measurements at. Apply it in the Logback configuration file, as described in Configure Log Levels.
    <logger name="com.xpn.xwiki.monitor" level="debug"/>
  4. Restart the servlet container, since both changes are read at start-up.
  5. Browse the wiki and read the log. Each request now produces a MONITOR record with its total duration, followed by one record per timer with the time spent there and the number of calls.
    2026-11-10 16:12:51,830 [qtp927327686-166] DEBUG c.x.x.m.a.MonitorData - MONITOR page [Sandbox.WebHome]: [243]ms
    2026-11-10 16:12:51,830 [qtp927327686-166] DEBUG c.x.x.m.a.MonitorData - MONITOR page [Sandbox.WebHome], action [view], timer [hibernate]: [86]ms in [14] calls

FAQ

Does it slow the wiki down?

A little. The shipped xwiki.cfg describes disabling it as worth a minor gain in performance and memory, which is why it is off by default. Turn it on to investigate, not to leave it on.

Why is the log silent after turning it on?

Because the plugin logs at debug, below the warn the root logger sits at. Step 3 is what makes its records visible; without it the plugin measures and nothing is written.

Can I read the measurements without the log?

Yes. XWiki ships a hidden page at /bin/view/XWiki/RequestsStatus that shows the requests being served, a consolidated duration per timer and the most recent requests. It is empty until the plugin is active, and nothing in the user interface links to it.

Related

Get Connected