Page MenuHomePhabricator

Reconsider caching in Wikibase\SitesModule::getScript
Closed, ResolvedPublic

Description

Wikibase\SitesModule is a content-versioned module, and in this profile of a startup module request, 16.5% of the time is spent in Wikibase\SitesModule::getScript(). This function caches its output, but only for 10 minutes, and it uses the server cache. Given its performance impact, we may want to consider caching it in WANCache instead, and for a longer period of time (e.g. 24 hours).

If there's way for this module to provide a definition summary that is guaranteed to change when the module contents change, but cheaper to compute, that would also be helpful. But I doubt that is the case given the fact that 2/3 of its time is spent in DBSiteStore::getSites(). The module also does message parsing, but that doesn't appear to contribute much to its slowness (probably because it only does it for a few "special" sites).

Event Timeline

Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald Transcript

@Ladsgroup I vaguely recall from Wikimania that you were doing some work on this, but I'm not sure if it was this class or something else with a similar name. Can you check if this has been improved since?

@Ladsgroup I vaguely recall from Wikimania that you were doing some work on this, but I'm not sure if it was this class or something else with a similar name. Can you check if this has been improved since?

It was something with similar name. Fixing this should not be hard though. Several steps can be done here.

  • Increasing the TTL to one hour given that site store cache is one-hour long
  • Making it WAN cache (I'm not super sure about this though. We had a problem a while back because PropertyInfo was using WAN that so big that was chocking the network) OTOH, value of this module is small enough. It's going to be shared between all wikis? That seems plausible

@Lydia_Pintscher : I don't think this should be in trailblaze exploration, it's super small.

I can make patches for this quickly. Is there a way that I can measure the impact?

Change 532776 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[mediawiki/extensions/Wikibase@master] Increase TTL of SitesModule from 10m to 1h

https://gerrit.wikimedia.org/r/532776

Change 532776 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Increase TTL of SitesModule from 10m to 1h

https://gerrit.wikimedia.org/r/532776

Krinkle claimed this task.
Krinkle reassigned this task from Krinkle to Addshore.
Krinkle removed a project: Performance Issue.