Changes

Jump to navigation Jump to search
132 bytes added ,  11:09, 9 August 2023
no edit summary
See Also:
 
*[https://github.com/memcached/memcached/wiki/Commands Memcache Commands]
*MediaWiki has a diagnostic tool for interacting with memcached in the 'maintenance' directory: [https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/maintenance/mcc.php mcc.php]
*[https://stackoverflow.com/questions/8420776/how-do-i-view-the-data-in-memcache Viewing data in memcache]
<blockquote>"Cache is King" - borrowed from the aphorism "Cash is King" For a full exploration of object caching in MediaWiki see https://www.mediawiki.org/wiki/Object_cache</blockquote>
== Making cache scalable ==
MediaWiki connects to memcached through a proxy called McRouter (Mick-ROW-ter) <ref>https://wikitech.wikimedia.org/wiki/Memcached_for_MediaWiki#Mcrouter</ref> Mcrouter was developed by Meta engineering back in 2014 for scaling memcached deployments <ref>https://engineering.fb.com/2014/09/15/web/introducing-mcrouter-a-memcached-protocol-router-for-scaling-memcached-deployments/</ref>. It's a core component of cache infrastructure at Facebook and Instagram where mcrouter handles almost 5 billion requests per second at peak.
Mcrouter supports typical memcache protocol commands like get, set, delete, etc. and specific commands to access stats, version and so on.<ref>https://github.com/facebook/mcrouter/wiki</ref>
== MediaWiki Interfaces ==
'''WANObjectCache''' (or '''WANCache''') is the primary interface in MediaWiki for interacting with Memcached and mcrouter. As the name implies, WANObjectCache is a multi-datacenter aware caching interface. See the [https://doc.wikimedia.org/mediawiki-core/master/php/classWANObjectCache.html#details class docs] for more detail on using and deploying WANObjectCache. [https://gerrit.wikimedia.org/g/mediawiki/core/%2B/master/includes/libs/objectcache/ Source in Gerrit] includes a README describing stats that go into StatsD
If you are a MediaWiki developer - especially a front-end dev, you've probably seen references in code to the 'BagOStuff' and wondered "what the heck is it?" BagOStuff is an abstract Class representing a cache/ephemeral data store. Concrete classes then build upon or implement BagOStuff in ways that are compatible with those concrete storage mechanisms. <ref>https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/includes/libs/objectcache/BagOStuff.php</ref> WANCache builds on top of '''BagOStuff''', which is the lower level key-value interface to Memcached and other storage backends.
{{References}}[[File:Wikipedia_Memcached_flow_2022.png|alt=illustration of Memcached flow from MediaWiki|right|955x955px|Memcached flow from MediaWiki]]<br />
[[Category:Caching]]
[[Category:Performance]]
<references />

Navigation menu