Memcached

From Wikitech
(Difference between revisions)
Jump to: navigation, search
(Editing mc.php)
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The memcached master php file is located in:
+
The memcache setup has changed '''recently''' for the multi-honed datacenter deployment (SDTPA vs EQIAD).
<tt>/home/wikipedia/common/wmf-deployment/wmf-config/mc.php</tt>
+
  
You can install a memcached server with:
+
When a memcache server is offline, it should be entirely removed from the configuration (if permanent) or commented out (if temporary.) Unlike the old slot format config file, the new format doesn't require you to keep an identical number of members deployed in the memcached pool.  Please note that one shouldn't add and remove a lot of members from this list in a short period of time, as the consistent hashing may result in a server being unpooled, then repooled to cause the keys to remap directly back to the same server, resulting in undesired performance.  So if a server is down, fix it ASAP.  If it cannot be rebooted and fixed ASAP, then it should be removed.  If it is removed, it may be prudent to leave it unpooled for 24 hours? (Aaron advises we have some items that can cache in mc for 24 hours.)
  <tt>apt-get install memcached</tt>
+
  
Be certain you start memcached after installThe installer states it is starting it, but it lies.
+
The memcached configuration php files are maintained in gerrit, under the operations/mediawiki-config branch.
 +
  <tt>mediawiki-config/wmf-config/mc-eqiad.php</tt>
 +
<tt>mediawiki-config/wmf-config/mc-pmtpa.php</tt>
  
You can test the servers to see which memcached are functioning and which are not with the following:
+
Memcached installation is handed via the puppet memcached role; and are currently deployed to dedicated memcache systems (mcX and mcXXXX).
<tt>cd /home/w/common/wmf-deployment/maintenance; php mctest.php</tt>
+
  
Note that all servers that are up will return <tt>incr: 100  get: 100</tt> and servers that are down will return <tt>incr: 0  get: 0</tt>.
 
  
= Editing mc.php =
+
You can test the servers to see which memcached are functioning and which are not with the following on fenari:
 +
<tt>cd /home/w/common/wmf-deployment/maintenance; mwscript mctest.php</tt>
  
Please note what the file says, the order and format is '''very important.'''  Make sure you add servers to the correct ***DOWN*** or ***SPARE*** sections, removing the slot number and replacing it with XX.  If you move a server into the memcached pool, ensure you remove the XX and put in the correct number.
+
Note that all servers that are up will return <tt>incr: 100   get: 100</tt> and servers that are down will return <tt>incr: 0  get: 0</tt>.
 
+
If you want to add a server from the spare list to the active list, please test it first. You can run
+
 
+
   <tt>/home/wikipedia/common/wmf-deployment/maintenance/mctest.php enwiki ip-address-here:11000</tt>
+
 
+
(it runs on a nonstandard port) and you should see output something like
+
  
  <tt>set: 100  incr: 100  get: 100 time: 0.0691230297089</tt>
+
== Editing mc.php ==
  
If instead you see something like
+
The memcached configuration php files are maintained in gerrit, under the operations/mediawiki-config branch.
 +
<tt>mediawiki-config/wmf-config/mc-eqiad.php</tt>
 +
<tt>mediawiki-config/wmf-config/mc-pmtpa.php</tt>
  
  <tt>set: 100  incr: 0  get: 0 time: 0.00236392021179</tt>
+
If you want to add a server from the spare list to the active list, please test it first. You can run on fenari
  
that server is not responding.
+
  <tt>cd /home/w/common/wmf-deployment/maintenance; mwscript mctest.php enwiki ip-address-here:11000</tt>
  
If you fix a memcached server and it is not immediately needed to go into rotation, be sure to move it from DOWN to SPARE.
+
(it runs on a nonstandard port). As above, servers that are up will return incr: 100 get: 100 and servers that are down will return incr: 0 get: 0.  
  
Once you finish updating the file, you need to sync it out with the following:
+
Once you finish updating the file, you must '''git commit''' and then '''git review'''.  You should be logged in as your own username, as your user keys will be checked.  Then you need to git fetch and merge on fenari in the /home/wikimedia/common/wmf-deployment directory and sync out changes.
  
<tt>sync-file mc.php ''enter the reason for updates'' </tt>
+
[[Category:How-To]]

Latest revision as of 00:33, 12 February 2013

The memcache setup has changed recently for the multi-honed datacenter deployment (SDTPA vs EQIAD).

When a memcache server is offline, it should be entirely removed from the configuration (if permanent) or commented out (if temporary.) Unlike the old slot format config file, the new format doesn't require you to keep an identical number of members deployed in the memcached pool. Please note that one shouldn't add and remove a lot of members from this list in a short period of time, as the consistent hashing may result in a server being unpooled, then repooled to cause the keys to remap directly back to the same server, resulting in undesired performance. So if a server is down, fix it ASAP. If it cannot be rebooted and fixed ASAP, then it should be removed. If it is removed, it may be prudent to leave it unpooled for 24 hours? (Aaron advises we have some items that can cache in mc for 24 hours.)

The memcached configuration php files are maintained in gerrit, under the operations/mediawiki-config branch.

mediawiki-config/wmf-config/mc-eqiad.php
mediawiki-config/wmf-config/mc-pmtpa.php

Memcached installation is handed via the puppet memcached role; and are currently deployed to dedicated memcache systems (mcX and mcXXXX).


You can test the servers to see which memcached are functioning and which are not with the following on fenari:

cd /home/w/common/wmf-deployment/maintenance; mwscript mctest.php

Note that all servers that are up will return incr: 100 get: 100 and servers that are down will return incr: 0 get: 0.

[edit] Editing mc.php

The memcached configuration php files are maintained in gerrit, under the operations/mediawiki-config branch.

mediawiki-config/wmf-config/mc-eqiad.php
mediawiki-config/wmf-config/mc-pmtpa.php

If you want to add a server from the spare list to the active list, please test it first. You can run on fenari

 cd /home/w/common/wmf-deployment/maintenance; mwscript mctest.php enwiki ip-address-here:11000

(it runs on a nonstandard port). As above, servers that are up will return incr: 100 get: 100 and servers that are down will return incr: 0 get: 0.

Once you finish updating the file, you must git commit and then git review. You should be logged in as your own username, as your user keys will be checked. Then you need to git fetch and merge on fenari in the /home/wikimedia/common/wmf-deployment directory and sync out changes.

Personal tools
Namespaces

Variants
Actions
Navigation
Ops documentation
Wiki
Toolbox