Editing Memcached/MediaWiki

From Bibliotheca Anonoma

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
== Activating Memcached ==
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 [[mediawikiwiki:Extension:OAuth|OAuth]] extension requires memcached.
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 [[mediawikiwiki:Extension:OAuth|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: {{ic|sudo apt-get install memcached}}
* RHEL/CentOS: {{ic|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.
{{hc|/etc/memcached.conf|<nowiki>
# 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
</nowiki>}}
Now, start the memcached service with default port and settings:
{{bc|sudo systemctl start memcached}}
Check that memcached is running:
{{bc|<nowiki>ps -eaf | grep memcached</nowiki>}}
Add memcached support to your MediaWiki install by editing LocalSettings.php:
{{hc|/var/www/mediawiki/LocalSettings.php|<nowiki>
$wgMainCacheType = CACHE_MEMCACHED;
$wgParserCacheType = CACHE_MEMCACHED; # optional
$wgMessageCacheType = CACHE_MEMCACHED; # optional
$wgMemCachedServers = array( "127.0.0.1:11211" );
$wgSessionsInObjectCache = true; # optional
$wgSessionCacheType = CACHE_MEMCACHED; # optional
</nowiki>}}
If everything is working, enable memcached to run at every startup:
{{bc|sudo systemctl enable memcached}}
== Sources ==


https://www.mediawiki.org/wiki/Memcached#Setup
https://www.mediawiki.org/wiki/Memcached#Setup


https://www.howtoforge.com/install-memcached-and-php5-memcached-module-on-debian-6.0-squeeze
https://www.howtoforge.com/install-memcached-and-php5-memcached-module-on-debian-6.0-squeeze
Please note that all contributions to Bibliotheca Anonoma are considered to be released under the Creative Commons Attribution-ShareAlike (see Bibliotheca Anonoma:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Templates used on this page: