From Bibliotheca Anonoma

Memcached is an alternative to the default APCu PHP caching system, and is designed to significantly lighten the load of queries on the database. Also, the OAuth extension requires memcached.

Memcached temporarily stores data from a database query in memory so that it can be quickly retrieved as necessary.

  • Debian/Ubuntu: sudo apt-get install memcached
  • RHEL/CentOS: sudo yum install memcached

By default memcached has only 64MB of memory allocated. Performance can be enhanced if you allocate it more memory, depending on how much you have and how large your database is. For example, to set this limit to 128MB, edit /etc/memcached.conf . Find this section in the file, and change -m 64 to -m 128, or whatever you prefer.

# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
# Note that the daemon will grow to this size, but does not start out holding this much
# memory
-m 64 # change this to 128

Now, start the memcached service with default port and settings:

sudo systemctl start memcached

Check that memcached is running:

ps -eaf | grep memcached

Add memcached support to your MediaWiki install by editing LocalSettings.php:

$wgMainCacheType = CACHE_MEMCACHED;
$wgParserCacheType = CACHE_MEMCACHED; # optional
$wgMessageCacheType = CACHE_MEMCACHED; # optional
$wgMemCachedServers = array( "" );
$wgSessionsInObjectCache = true; # optional
$wgSessionCacheType = CACHE_MEMCACHED; # optional

If everything is working, enable memcached to run at every startup:

sudo systemctl enable memcached