Memcached: Difference between revisions
expand content |
No edit summary |
||
| Line 4: | Line 4: | ||
See Also: | See Also: | ||
*[https://github.com/memcached/memcached/wiki/Commands Memcache Commands] | *[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] | *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] | *[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> | <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 == | ==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. | 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. | ||
| Line 17: | Line 18: | ||
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> | 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 == | ==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 | '''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 | ||
| Line 25: | Line 26: | ||
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. | 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. | ||
[[File:Wikipedia_Memcached_flow_2022.png]] | {{References}} | ||
[[File:Wikipedia_Memcached_flow_2022.png|alt=illustration of Memcached flow from MediaWiki|right|955x955px|Memcached flow from MediaWiki]] | |||
<br /> | |||
[[Category:Caching]] | [[Category:Caching]] | ||
[[Category:Performance]] | [[Category:Performance]] | ||
<references /> | |||