Page MenuHomePhabricator

MediaWiki-Core-HTTP-CacheComponent
ActivePublic

Members

  • This project does not have any members.
  • View All

Details

Description

The HTTP Cache component handles CDN purging and FileCache storage in MediaWiki core.

This includes:

  • The HtmlCacheUpdater service and its related wiring/configuration.
  • The HtmlCacheUpdater execution logic (the wrappers that run this via deferred update, job, and purgeList.php maintenance script).
  • The FileCache service and its related wiring/configuration. https://www.mediawiki.org/wiki/Manual:File_cache.

Maintained by: Performance-Team
Parent project: MediaWiki-General

Recent Activity

Wed, Dec 3

Krinkle removed a project from T369898: Reduce the number of resource_change and resource_purge events emitted due to template changes: MediaWiki-Engineering.
Wed, Dec 3, 3:00 PM · Content-Transform-Team, Essential-Work, MW-1.43-notes (1.43.0-wmf.16; 2024-07-30), serviceops, Performance Issue, MediaWiki-Core-HTTP-Cache, ChangeProp

Tue, Nov 25

Wbm1058 placed T135964: Force pages to be fully re-parsed occasionally up for grabs.

Well, I implemented my bot a long time ago, and check in on it occasionally. It's been working well, and anyone considering forcing purges from the server level is welcome to use whatever pieces of my code might be helpful.

Tue, Nov 25, 5:28 PM · MediaWiki-Core-HTTP-Cache, MediaWiki-Parser

Nov 16 2025

Pppery edited projects for T317170: Multiple filecache invalidation, added: Patch-Needs-Improvement; removed Patch-For-Review.
Nov 16 2025, 3:05 AM · Patch-Needs-Improvement, MediaWiki-Core-HTTP-Cache

Oct 17 2025

Bawolff added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

One potential problem though is that when purging an image page, doing the purge POSTSEND might make the user see stale data as typically users don't have a cache busting cookie for the image server. So i guess file purges should still be PRESEND.

Oct 17 2025, 10:30 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache
Bawolff added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

Part of the issue here is that curl removed support for http/1.1 pipelining which made this much slower. Edit: Seems like without pipelining it just opens multiple tcp connections at the same time, so the latency difference really shouldn't be that much

Oct 17 2025, 7:56 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache
Bawolff added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

I just encountered another wiki where doing these PRESEND was the cause of a major save time latency (was taking multiple seconds to send cdn purges). I think this is a major performance hurdle for most wikis using HTTP based cache purging.

Oct 17 2025, 1:47 AM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache

Oct 1 2025

JaydenKieran added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

I'm pretty sure that you get a session cookie if you edit while logged out (regardless of if you have the new temporary accounts feature enabled or not), unless that has changed since 1.43. I think a reasonable approach to this issue, if WMF have concerns about using POSTSEND, is to allow third-party wikis to configure this without needing to edit the source code.

Oct 1 2025, 12:05 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache

Sep 29 2025

Bawolff added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

Session yes, if they're logged in, or reached Special:CreateAccount/Special:UserLogin. Anons get the ChronologyProtector cookie but that only lasts 10s, and might also often not be configured to exempt from caches on third-party setups.

Sep 29 2025, 4:17 AM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache

Sep 28 2025

Alex44019 added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

Session yes, if they're logged in, or reached Special:CreateAccount/Special:UserLogin. Anons get the ChronologyProtector cookie but that only lasts 10s, and might also often not be configured to exempt from caches on third-party setups.

Sep 28 2025, 9:00 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache

Sep 25 2025

Bawolff added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

Wouldn't the editor having a session prevent them from seeing stale pages?

Sep 25 2025, 8:56 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache
Justin_C_Lloyd added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

This sounds like at least part of the reason why I haven't really tried to get my wikis working with a CDN (CloudFront since they're in AWS), concern about this kind of latency issue.

Sep 25 2025, 8:49 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache
aaron added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

In this case, it sounds like it would run into the problem of users seeing stale pages (even without other slow deferred updates, but worse with them). I know that CDNCacheUpdates try to merge into batch updates, and we have an HTTP purge client class that does multiple URLs concurrently. Is it taking multiple seconds to purge a single URL? That seems like an operational problem.

Sep 25 2025, 8:46 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache
SomeRandomDeveloper added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

On WMF sites, the update just queues the purge into another service, so it's quick.
[...]
Our own purge queuing service is pretty quick, so that risk is minimal as a PRESEND update.

Then it probably might be worth adding a setting so 3rd party wikis and wiki farms where purging takes longer can control whether it uses PRESEND or POSTSEND.

Sep 25 2025, 8:39 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache
aaron added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

On WMF sites, the update just queues the purge into another service, so it's quick. We also don't want the deferred purge update to end up running after a bunch of slow POSTEND deferred updates. Since these POSTEND do not block the user, in that case, the user might have a decent chance of seeing stale data, since they can follow redirects and navigate around before the deferred purge update gets started. Our own purge queuing service is pretty quick, so that risk is minimal as a PRESEND update. We can't control how fast *other* POSTSEND updates are though.

Sep 25 2025, 8:31 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache
Bawolff added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

In case its not clear, sending this PRESEND can cause significant latency if you are using traditional HTTP purging and have multiple cache servers. I think the request here is to change this to POSTSEND unless there is a compelling reason why doing that would be a bad idea.

Sep 25 2025, 6:16 AM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache

Sep 24 2025

Taylan added a comment to T405301: Document why cache purging (sending HTTP PURGE) is synchronous.

As a test, I've done the following:

Sep 24 2025, 4:58 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache

Sep 23 2025

Reedy added a project to T405301: Document why cache purging (sending HTTP PURGE) is synchronous: MediaWiki-Documentation.
Sep 23 2025, 8:26 AM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache
Aklapper renamed T405301: Document why cache purging (sending HTTP PURGE) is synchronous from Why is cache purging (sending HTTP PURGE) synchronous? to Document why cache purging (sending HTTP PURGE) is synchronous.
Sep 23 2025, 8:01 AM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache

Sep 22 2025

Taylan created T405301: Document why cache purging (sending HTTP PURGE) is synchronous.
Sep 22 2025, 11:26 PM · MediaWiki-Documentation, MediaWiki-Core-HTTP-Cache

Sep 18 2025

A_smart_kitten added a comment to T351573: Main Page offers yesterday's content for logged out users.

Noting T404941: {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} is not automatically updated in mobile, but updated in dekstop view, which seems quite similar to what's reported here, except that there's also a report there of a Main Page showing outdated content to logged-in users on mobile (T404941#11194701).

Sep 18 2025, 5:10 PM · MediaWiki-Core-HTTP-Cache, MediaWiki-Platform-Team (Roadmap)

Apr 14 2025

Seb35 added a comment to T50835: Separate Cache-Control header for proxy and client.

There is the RFC 9213 "Targeted HTTP Cache Control" published in June 2022 related to this task: the idea is to use a header CDN-Cache-Control dedicated to the reverse proxies/CDN with the same semantics as Cache-Control.

Apr 14 2025, 3:50 PM · Wikimedia-Performance-recommendation, MediaWiki-Core-HTTP-Cache, Traffic-Icebox, Platform Engineering, SRE

Apr 11 2025

Aklapper changed the status of T349882: Vector-2022: Menu Icon Appears Twice from In Progress to Open.

Resetting task status from "In Progress" to "Open" as this task has been "in progress" for more than one and a half years (see T380300).

Apr 11 2025, 10:12 PM · Vector 2022

Apr 3 2025

Krinkle added a comment to T351573: Main Page offers yesterday's content for logged out users.

I suspect this may be caused by the use of grace (akin to stale-while-revalidate). This allows pages, even those with an intentionally shortened max-age (eg 1h instead of the default wgCdnMaxAge of 14 days, and wgParserCacheExpireTime of 30 days) to be renewed via HTTP 304.

Apr 3 2025, 4:23 AM · MediaWiki-Core-HTTP-Cache, MediaWiki-Platform-Team (Roadmap)

Apr 1 2025

Krinkle edited projects for T351573: Main Page offers yesterday's content for logged out users, added: MediaWiki-Core-HTTP-Cache; removed MediaWiki-libs-BagOStuff.
Apr 1 2025, 7:47 PM · MediaWiki-Core-HTTP-Cache, MediaWiki-Platform-Team (Roadmap)

Mar 4 2025

RLazarus closed T387208: Ensure tls-proxy container is started before launching main container, a subtask of T387127: mwscript-k8s purgeList does not reliably purge cached URLs, as Resolved.
Mar 4 2025, 9:37 PM · MediaWiki-Core-HTTP-Cache, MW-on-K8s, serviceops

Feb 26 2025

Pppery merged T387262: co.wikimedia logo not updating after deployment into T387127: mwscript-k8s purgeList does not reliably purge cached URLs.
Feb 26 2025, 1:17 AM · MediaWiki-Core-HTTP-Cache, MW-on-K8s, serviceops

Feb 25 2025

RLazarus merged task T387127: mwscript-k8s purgeList does not reliably purge cached URLs into T387208: Ensure tls-proxy container is started before launching main container.
Feb 25 2025, 5:17 PM · MediaWiki-Core-HTTP-Cache, MW-on-K8s, serviceops

Feb 24 2025

RLazarus claimed T387127: mwscript-k8s purgeList does not reliably purge cached URLs.

purgeList from mwscript-k8s has worked previously, so my instinct is this is an intermittent problem rather than any of the possible "we just forgot to set this up" situations.

Feb 24 2025, 10:11 PM · MediaWiki-Core-HTTP-Cache, MW-on-K8s, serviceops
Lucas_Werkmeister_WMDE added a project to T387127: mwscript-k8s purgeList does not reliably purge cached URLs: MediaWiki-Core-HTTP-Cache.
Feb 24 2025, 3:05 PM · MediaWiki-Core-HTTP-Cache, MW-on-K8s, serviceops

Dec 18 2024

Joe added a comment to T369898: Reduce the number of resource_change and resource_purge events emitted due to template changes.

I don't see how we can stop caching and purging the rest api urls.

We are currently not using the CDN cache for the new page/html endpoints. This may however change when they get used more.

In general, the access pattern for these APIs is much more "flat" than organic access, since they tend to be used bycrawlers. So they benefit a lot less from caching, the hit rate is likely low.

Dec 18 2024, 10:23 AM · Content-Transform-Team, Essential-Work, MW-1.43-notes (1.43.0-wmf.16; 2024-07-30), serviceops, Performance Issue, MediaWiki-Core-HTTP-Cache, ChangeProp

Dec 17 2024

daniel added a comment to T369898: Reduce the number of resource_change and resource_purge events emitted due to template changes.

I don't see how we can stop caching and purging the rest api urls.

Dec 17 2024, 3:26 PM · Content-Transform-Team, Essential-Work, MW-1.43-notes (1.43.0-wmf.16; 2024-07-30), serviceops, Performance Issue, MediaWiki-Core-HTTP-Cache, ChangeProp
Joe added a comment to T369898: Reduce the number of resource_change and resource_purge events emitted due to template changes.

I don't see how we can stop caching and purging the rest api urls.

Dec 17 2024, 2:56 PM · Content-Transform-Team, Essential-Work, MW-1.43-notes (1.43.0-wmf.16; 2024-07-30), serviceops, Performance Issue, MediaWiki-Core-HTTP-Cache, ChangeProp
Krinkle added a comment to T369898: Reduce the number of resource_change and resource_purge events emitted due to template changes.

Right now, we send purges for each edit as follows:

  • the main on-wiki url
  • the main on-wiki url with action=history
  • the mobile on-wiki url
  • the restbase url for page/html
Dec 17 2024, 2:33 PM · Content-Transform-Team, Essential-Work, MW-1.43-notes (1.43.0-wmf.16; 2024-07-30), serviceops, Performance Issue, MediaWiki-Core-HTTP-Cache, ChangeProp

Dec 12 2024

Joe added a comment to T369898: Reduce the number of resource_change and resource_purge events emitted due to template changes.

For completeness, another option is the varnish "x-key" system, which involves two research projects. One is that implementation of x-key in varnish appears to be incomplete, and the second is that the assignment of appropriate x-keys to URLs is non-trivial as well. There are too many templates used on a page like [[Barack Obama]] to naively assign one x-key to every recursively-included template, so we still need to come up with a mechanism to determine which of the templates deserve an x-key assigned, likely based on purge statistics.

Dec 12 2024, 9:12 AM · Content-Transform-Team, Essential-Work, MW-1.43-notes (1.43.0-wmf.16; 2024-07-30), serviceops, Performance Issue, MediaWiki-Core-HTTP-Cache, ChangeProp
daniel updated the task description for T369898: Reduce the number of resource_change and resource_purge events emitted due to template changes.
Dec 12 2024, 8:31 AM · Content-Transform-Team, Essential-Work, MW-1.43-notes (1.43.0-wmf.16; 2024-07-30), serviceops, Performance Issue, MediaWiki-Core-HTTP-Cache, ChangeProp

Dec 11 2024

cscott added a comment to T369898: Reduce the number of resource_change and resource_purge events emitted due to template changes.

This might be a reasonable pair of hypotheses for annual planning:

  1. Instrument edits to identify edits with the highest rank (edit frequency * usage count * % no op edits) and analyze to determine edit reason and whether website scalability could be improved by omitting CDN purges for these edits.
Dec 11 2024, 3:27 PM · Content-Transform-Team, Essential-Work, MW-1.43-notes (1.43.0-wmf.16; 2024-07-30), serviceops, Performance Issue, MediaWiki-Core-HTTP-Cache, ChangeProp
cscott added a comment to T369898: Reduce the number of resource_change and resource_purge events emitted due to template changes.

Note that this is decoupling the reparsing/ParserCache invalidation done by the RefreshLinksJobs (which is mandatory and must be done) from the front-end cache (CDN/PCS) invalidation (which is optional and may be skipped).

Dec 11 2024, 3:11 PM · Content-Transform-Team, Essential-Work, MW-1.43-notes (1.43.0-wmf.16; 2024-07-30), serviceops, Performance Issue, MediaWiki-Core-HTTP-Cache, ChangeProp

Nov 21 2024

BPirkle moved T308424: Determine http cache control and active purging for REST endpoints serving parsoid output from Incoming (Needs Triage) to Needs Further Discussion on the MW-Interfaces-Team board.
Nov 21 2024, 4:28 PM · MW-Interfaces-Team, RESTBase Sunsetting, SRE, MediaWiki-Core-HTTP-Cache, Traffic, MediaWiki-REST-API
MSantos moved T308424: Determine http cache control and active purging for REST endpoints serving parsoid output from Doing to Parsoid pile on the RESTBase Sunsetting board.
Nov 21 2024, 11:45 AM · MW-Interfaces-Team, RESTBase Sunsetting, SRE, MediaWiki-Core-HTTP-Cache, Traffic, MediaWiki-REST-API
MSantos placed T308424: Determine http cache control and active purging for REST endpoints serving parsoid output up for grabs.
Nov 21 2024, 11:44 AM · MW-Interfaces-Team, RESTBase Sunsetting, SRE, MediaWiki-Core-HTTP-Cache, Traffic, MediaWiki-REST-API
MSantos edited projects for T308424: Determine http cache control and active purging for REST endpoints serving parsoid output, added: MW-Interfaces-Team; removed API Platform (RESTBase Deprecation Roadmap), Platform Team Workboards (MW Expedition).
Nov 21 2024, 11:07 AM · MW-Interfaces-Team, RESTBase Sunsetting, SRE, MediaWiki-Core-HTTP-Cache, Traffic, MediaWiki-REST-API

Nov 19 2024

Aklapper placed T309572: Null Edit doesn't seem to trigger CdnCacheUpdate::purge for 1.37.2 up for grabs.

@aaron: Removing task assignee as this open task has been assigned for more than two years - See the email sent to task assignee on October 11th.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome! :)
If this task has been resolved in the meantime, or should not be worked on by anybody ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!

Nov 19 2024, 5:44 PM · Wikimedia-Performance-recommendation, MediaWiki-Core-HTTP-Cache

Nov 15 2024

matmarex closed T379841: Caching on beta.metawiki playing up as Declined.

Declining per Krinkle. I guess we can hope that this was an isolated and Beta-only issue, until it happens again.

Nov 15 2024, 10:30 PM · MediaWiki-Platform-Team, MediaWiki-Core-Revision-backend, MediaWiki-Core-HTTP-Cache, Beta-Cluster-Infrastructure
matmarex added a comment to T379841: Caching on beta.metawiki playing up.

FWIW, I could see the issue when this task was filed, about 7 hours after the revert.

Nov 15 2024, 10:29 PM · MediaWiki-Platform-Team, MediaWiki-Core-Revision-backend, MediaWiki-Core-HTTP-Cache, Beta-Cluster-Infrastructure
daniel edited projects for T379841: Caching on beta.metawiki playing up, added: MediaWiki-Platform-Team; removed MW-Interfaces-Team.
Nov 15 2024, 8:55 AM · MediaWiki-Platform-Team, MediaWiki-Core-Revision-backend, MediaWiki-Core-HTTP-Cache, Beta-Cluster-Infrastructure

Nov 14 2024

Krinkle attached a referenced file: F57701230: Screenshot 2024-11-14 at 13.59.37.png.
Nov 14 2024, 2:00 PM · MediaWiki-Platform-Team, MediaWiki-Core-Revision-backend, MediaWiki-Core-HTTP-Cache, Beta-Cluster-Infrastructure
Krinkle added a comment to T379841: Caching on beta.metawiki playing up.

I can't reproduce this issue.

Nov 14 2024, 2:00 PM · MediaWiki-Platform-Team, MediaWiki-Core-Revision-backend, MediaWiki-Core-HTTP-Cache, Beta-Cluster-Infrastructure
Tgr added a comment to T379841: Caching on beta.metawiki playing up.

They look identical to me. In production (if the caching happens in Varnish) caching bugs might depend which of the many Varnish frontends you end up talking to (so in the end, your IP); I think we only have one Varnish server on beta so it should be deterministic. Maybe the purge was just very slow (ie. job queue lag)?

Nov 14 2024, 1:47 PM · MediaWiki-Platform-Team, MediaWiki-Core-Revision-backend, MediaWiki-Core-HTTP-Cache, Beta-Cluster-Infrastructure

Nov 13 2024

matmarex added projects to T379841: Caching on beta.metawiki playing up: MW-Interfaces-Team, MediaWiki-Core-Revision-backend.
Nov 13 2024, 10:56 PM · MediaWiki-Platform-Team, MediaWiki-Core-Revision-backend, MediaWiki-Core-HTTP-Cache, Beta-Cluster-Infrastructure
Seddon created T379841: Caching on beta.metawiki playing up.
Nov 13 2024, 10:49 PM · MediaWiki-Platform-Team, MediaWiki-Core-Revision-backend, MediaWiki-Core-HTTP-Cache, Beta-Cluster-Infrastructure