Performances

Version 14.5 by Vincent Massol on 2008/04/11
Warning: For security reasons, the document is displayed in restricted mode as it is not the current version. There may be differences and errors due to this.

Failed to execute the [velocity] macro. Cause: [The execution of the [velocity] script macro is not allowed in [xwiki:Documentation.AdminGuide.Performances.WebHome]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Performances

Here are some tips to increase XWiki's performances.

Gzip compression and caching of static pages

We're working on making these features part of the XWiki core (see XWIKI-2022). While waiting for this to be natively implemented, the recommended solution is to set up an Apache Web Server in front of your servlet container and install/configure the following modules:

Modify your Apache configuration file to load the different modules:

LoadModule expires_module /usr/lib/apache2/modules/mod_expires.so
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
# Depends: proxy
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so

And configure your different modules as described below.

Mod Deflate Configuration

vwwwpro-1:~# cat /etc/apache2/conf.d/deflate
<Location />
   # Insert filter
   SetOutputFilter DEFLATE

   # Netscape 4.x has some problems...
   BrowserMatch ^Mozilla/4 gzip-only-text/html

   # Netscape 4.06-4.08 have some more problems
   BrowserMatch ^Mozilla/4\.0[678] no-gzip

   # MSIE masquerades as Netscape, but it is fine
   # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

   # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
   # the above regex won't work. You can use the following
   # workaround to get the desired effect:
   BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

   # Don't compress images
   SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

   # Make sure proxies don't deliver the wrong content
   #Header append Vary User-Agent env=!dont-vary
</Location>

Mod Expire Configuration

vwwwpro-1:~# cat /etc/apache2/conf.d/expires
<Location /xwiki/skins/>
       ExpiresActive on
       ExpiresDefault "access plus 1 day"
</Location>

<Location /xwiki/bin/skin/>
       ExpiresActive on
       ExpiresDefault "access plus 1 day"
</Location>

Mod Proxy AJP Configuration

ProxyRequests Off
   <Proxy *>
       Order deny,allow
       Allow from all
   </Proxy>
   ProxyPreserveHost On
   ProxyPass /xwiki ajp://192.168.1.181:8009/xwiki

where ajp://192.168.1.181:8009/xwiki is the internal address of your Servlet container where XWiki is running.

Memory

You need to configure your Servlet container so that XWiki has enough memory. You'll need to tune the value to your need. You should check the logs and see if there are any out of memory errors. A good default value is 384MB (-Xmx384m).

Here are the values used for xwiki.org's web site:

CATALINA_OPTS="-server -Xms128m -Xmx1024m -XX:MaxPermSize=128m -Dfile.encoding=utf-8 -Djava.awt.headless=true -XX:+UseParallelGC -XX:MaxGCPauseMillis=100"

Database Indexes

Make sure you've set Database indexes. This is especially important when you start having lots of documents.

Panels

Some Panels take more resources than others. For example the Navigation panel should NOT be used for wikis with a lot of documents since it displays all documents in the wiki. In the future that Panel should be improve for performances but that's not the case right. Originally this Panel was only meant as a starting point. A better approach is to use a Quick Links Panel as we've now set up in the default XWiki Enterprise wiki version 1.1 (we've removed the default usage of the Navigation Panel in that version).

Statistics

The statistics module is off by default since it's quite Database intensive. If you don't need it you should turn it off.

Monitoring

More a developer-oriented feature, XWiki can monitor its own code, reporting the time spent for each sub-component activated during a request. While the monitoring code isn't time consuming, it increases the memory consumption a bit, and the create/start/stop/log/destroy calls are spread all around the code, so you will save a lot of method calls by disabling this. You can do that by setting the following line in xwiki.cfg:

xwiki.monitor=0

Cache sizes

Tune the document cache in xwiki.cfg. The value depends on how much memory you have. The higher the better. A good reasonable value is 1000.

xwiki.store.cache.capacity=1000

Rendering cache

Some pages are complex to render (they may aggregate outside data for example or do complex and slow queries). For these pages you can add the following to their content to cache them after they are rendered. For example to cache the rendered content for 60 seconds you would add:

$context.setCacheDuration(60)

Merge the CSS files

In order to reduce the number of requests and files that are downloaded from the browser or client, it could help to merge all XWiki CSS files into a single one. See the Merge CSS Snippet

While a pretty neat feature, keeping track of the backlinks has a medium impact on the document saving time and a minor impact on the document loading time. If you feel that your wiki does not need backlinks, you can safely disable them with the following line in xwiki.cfg:

xwiki.backlinks=0

Versioning

One of the key features of any wiki system, versioning greatly affects the database size and the document update time. If you are sure your wiki does not need to keep track of all the changes and you will never need to revert documents to a previous version, then you can add the following line in xwiki.cfg

xwiki.store.versioning=0

Wiki syntax features

If you don't plan to use all of the wiki features, like the strikethrough filter, the automatic http links filter, the SVG, Laszlo or style macros, you can disable them in xwiki-core-*.jar/META-INF/services/com.xpn.xwiki.render.*. The wiki rendering is the most costly operation in the rendering process, so any disabled feature counts.

Get Connected