Performance tuning MediaWiki

Wiki browsing is significantly faster by using a PHP opcode cache.

I installed the Alternative PHP Cache, otherwise known as APC. Facebook used to use and contribute to this software.

Configuration is achieved via a simple 3-step process.

  • Install APC (PHP Extension)
  • Install the MediaWiki APC Extension
  • Configure MediaWiki’s LocalSettings.php
  • yum -y install php-pecl-apc
    
    ## Check the options
    php -i | grep apc
    
    ## Read through the configuration options
    less /usr/share/doc/php-pecl-apc-3.1.9/INSTALL
    
    cd /var/www/html/mediawiki/extensions
    git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/APC.git
    

    Edit /var/www/html/mediawiki/LocalSettings.php and add :

    $wgGroupPermissions['apc']['apc'] = true; 
    
    require_once("$IP/extensions/APC/APC.php"); 
    

    After testing the improved latency to your wiki, you may then want to view your opcode cache statistics, i.e. hits and misses :
    https://www.myhost.net/wiki/index.php/Special:APC

    Further reading :
    http://pecl.php.net/package/APC
    http://www.mediawiki.org/wiki/Extension:APC
    http://en.wikipedia.org/wiki/List_of_PHP_accelerators

    Advertisements
    This entry was posted in mediawiki. Bookmark the permalink.

    One Response to Performance tuning MediaWiki

    1. Glitchdata says:

      Thanks for the optimisation tips. More MW optimisations noted here:
      http://wiki.glitchdata.com/index.php?title=MediaWiki:Performance

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s