Skip to content

MediaWiki: some important simple checks to get decent performances

I don’t know why, but I really screwed up pretty bad the previous MediaWiki update at Wiki4Games. I mean, all went fine, no data were lost, the downtime was maybe half a minute. But gosh, what terrible performances! The server didn’t seem that slow at first, though, so I missed it. And since I (sadly) don’t really use W4G often now, whenever I came back I thought maybe it’s normal for a wiki to have that kind of speed (or, actually, lack thereof).

Thanks to a crash, about a week ago, I first noticed that image thumbnails weren’t cached properly, which I then fixed. After that, it was a bit faster. But still not quite “fast”.

Today, I decided that maybe I’d try to upgrade to MW 1.18 to fix the slowness. Doing so I review about every folders, and noticed that the cache folder, too, had permission issues… That’s right, the server wasn’t able to cache any thing… or so I thought (in fact, caching wasn’t enabled so permissions alone wouldn’t help). Now I fixed that, and I can finally say that the wiki is decently fast.

So, to sum up, first things to check when your MediaWiki install is too slow:

  1. Are permissions correct for images/*? The webserver must have read/write permissions for all this folder and subfolder, particularly images/temp and images/thumb
  2. Did you activate some form of caching, and, if you use disk caching, are permissions correct for your cache folder?

To activate caching, many methods are available (see the manual). The simplest one can be achieved with just a few lines in LocalSettings.php, such as:

// Performance tweaks
$wgMainCacheType = CACHE_ACCEL;
$wgShowIPinHeader = false;
$wgUseFileCache = true;
$wgFileCacheDirectory = '/some/path/cache';
$wgCacheDirectory = '/some/path/cache';
$wgEnableSidebarCache = true;

Note I’m not too sure if setting wgFileCacheDirectory and $wgCacheDirectory is a great idea, but that seems to work for the moment. What I’m sure of, though, is that you should make sure your cache folder isn’t accessible from the web (or at least put an .htaccess file in it to deny all access). Oh, and you have to create the cache folder yourself (it won’t generate itself if you just add it to the configuration).

Posted in MediaWiki.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA