Walter Vermeir wrote:
How does the caching of pages for the WMF projects
work?
== Setting ==
On 1th April the [[MediaWiki:Tagline]] page, controlling the "From
Wikipedia, the free encyclopedia" text line, was changed several
times.
From; 08:06, 1 April 2008
until; 08:07, 1 April 2008
so at max 1 minute, probably shorter, the text was;
"From Britannica, the encyclopedia that is slightly more accurate than
Wikipedia according to a paper in the eminent journal ''Nature''...
"
After that is was changed again a couple of times in to different
messages during that day;
From Wikipedia, the free Pokémon encyclopedia
From Whippetpedia, the free encyclopedia for dogs
From Wikipedia, the free encyclopedia administer by people with a
stick up their lavender passageway
From Wikipedia, the free encyclopedia that triples in population every
six months
One of the edit summary's was;
"Relax; these are completely harmless, and just for a day. "Yes, we're
aware of Wikipedia's criticisms, and we're still confident enough in
our project that we can joke about it"
== On topic ==
When I requested the page;
http://en.wikipedia.org/wiki/Blue_Gender
around midnight 2008-04-07 I noticed that the tagline on that page was;
"From Britannica, the encyclopaedia that is slightly more accurate
than Wikipedia according to a paper in the eminent journal
''Nature''... "
When I logged in it was gone, back the normal one. Also when I logged
out again it was also again the normal tag line.
== My question ==
How does the caching works?
I suspect that I have seen that changed tag line on that page because
that specific page was cached just in that very short time frame the
tag line was changed to that text. And because the page was not
edited that cached version was not renewed.
What I like to know is how long can cached version being used to show
a page when it is requested? When does it expire?
And because there are many squids; can it be that depending the squid
who serves you can get different results?
I would like to know that for use in wikizine.
Firstly note that we are talking about the anonymous user cache. Pages for
logged-in users are generated each time based on various cached and
uncached data. Pages for anonymous users are cached in their entirety.
By default, wiki pages cached in squid expire after 31 days. The long
expiry time is needed to obtain a decent hit rate for rarely-requested pages.
MediaWiki uses a variety of methods to ensure that the information the
user sees is up to date. The first and most obvious is that when a page is
edited, its cache entry is immediately deleted (i.e. purged) from all squids.
Another method is to use tracking tables to track the dependencies of the
cached item. We track links, templates, categories and local (non-commons)
image usage. When an object changes, we check the tables to see what
cached pages depend on that object, and we purge them.
It is not feasible to purge every single page on the wiki whenever an
admin changes a user interface element such as the tagline. The
performance impact would be too great. So when we need to make temporary
changes to the HTML, such as site notices, we can do two things:
* Temporarily reduce the expiry time for newly cached pages
* Use JavaScript to dynamically load the changeable area on the client side
Originally we did the first, but now we have the tools in place to do the
second. Admins on April 1 would have been well advised to use such a
technique, such as JavaScript or an iframe.
-- Tim Starling