Please note that all blog posts before 8 April 2007 were automatically imported from LiveJournal.  To see the comments and any LiveJournal-specific extras such as polls and user icons, please find the source posting at http://brianenigma.livejournal.com/2007/01/

Note to future self (and to anyone else who may be setting up a high-traffic[1] MediaWiki server at some point):

In theory, all you need to do to enable caching, which greatly improves performance is to add the following lines to LocalSettings.php. Everything is very well documented to reinforce that this is what you need to do.

$wgShowIPinHeader = false;
 * This will cache static pages for non-logged-in users to reduce
 * database traffic on public sites.
 * Must set $wgShowIPinHeader = false
$wgUseFileCache = true;

As Dreamhost and I discovered by my 30% CPU utilization, this is not the entire story. There is one setting, mentioned nowhere except include/DefaultSettings.php. It looks quite innocent and actually, it is.

/** Directory where the cached page will be saved */
$wgFileCacheDirectory = false; /// defaults to "{$wgUploadDirectory}/cache";

The problem being that wgUploadDirectory is, by default “images/” and in a default installation, there is no “images/cache/” folder. MediaWiki does not create this directory, even if it has the permissions to do so. When there is no cache folder, caching is effectively disabled. So the above two settings don’t mean anything until the images/cache/ directory exists.

[1] In this case, it is a MediaWiki install that has had for January (so far) 4 million requests to 34,471 unique hosts, transferring 313 GB of data.

Posted in: Code

One thought on “wgFileCacheDirectory”

Leave a Reply

Your email address will not be published. Required fields are marked *