Manual:Memcached

<- MediaWiki architecture

memcached is a memory-based object store, developed originally to lighten the load on LiveJournal's database servers. memcached has been supported in MediaWiki since pre v1.1.

memcached.txt in the source still seems to be the best documentation. Could refactor it here?. There is also mw:Manual:Configuration_settings

-

Old Development Notes
Broadly speaking, we'd like to be able to dump lots of data in the cache, use it whenever we can, and automatically expire it when changes are made.

Expiration model

 * explicit expiration times: memcached lets us set an expiration time on an object when we store it. After the time is up, another request for the object will find that it has expired and return nothing to us.
 * pro: last-ditch fallback to let data that could be updated badly eventually fall out of the cache
 * con: we have to know ahead of time when it will cease to be invalid. hard to do when we're dealing with user edits!


 * delete cached objects when we know we're doing something that will cause them to be invalid but are not in a position to update them while we're at it
 * pro: fairly simple; the item will be reloaded from the database and recached when it's next needed
 * con: if this will affect a large number of related items (for instance, creating or deleting a page invalidates the links/brokenlinks tables and rendered HTML cache of pages that link to that page) we may have to hunt them all down and do a lot of updating


 * include timestamps on cached objects and do our own expiries based on dependencies
 * pro: can expire many objects at once by updating a single node they depend on
 * con: more things to load; multiple dependencies could be trickier to work with


 * Delete cached when someone presses a button to do so (or when the page is changed) (Note:non-programmer idea -- delete if stupid)
 * pro: No unnecessary recacheing, but if someone really wants to see what it looks like with all of the link colors correct, they can.
 * con: Potentially abusable to elevate server load.

Questions & Answers
Q: The current plan is to deploy six load balanced Apaches, the likeliness that one of them renders the same page twice should be 1/6 of the current value, right?

A: Memcached is a shared cache between all Apaches, communication is done with TCP.

Q: ''Squid will cache the majority of content, reducing repetitions drastically. What's the point in memcached then?''

A: The squid only replaces the anonymous cache. Memcached has far wider applicability, both currently implemented and potentially. -- Tim Starling 02:12, 16 Jan 2004 (UTC) (Questions by Gwicke)

Q: How can the memcache java client work while the php client is being used in the browser?

A: Sorry?