Page MenuHomePhabricator

Fetching messages in non-content languages is slow, makes startup module time out in Vagrant
Closed, ResolvedPublic

Description

If you use a non-content language (e.g. your wiki's language is en, but you request messages in fr), MessageCache will query all MediaWiki:*/fr pages from the database and load them. But then when you request a particular message (e.g. foo), it'll query the database again to see if MediaWiki:Foo/fr exists. It doesn't do this extra query for the content language, only for non-content languages.

This appears to be a regression from rMW4fc5ba8bf831: messagecache: check overridable message array in getMsgFromNamespace() (for T193271). It slows down every message fetch, obviously, but in particular it slows down the process of building ResourceLoader's startup module so much that it times out (takes more than 30 seconds) in my local Vagrant setup.

Event Timeline

Catrope created this task.Jul 19 2019, 11:44 PM
Restricted Application added a project: Performance-Team. · View Herald TranscriptJul 19 2019, 11:44 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Catrope claimed this task.Jul 19 2019, 11:44 PM

Change 524626 had a related patch set uploaded (by Catrope; owner: Catrope):
[mediawiki/core@master] MessageCache: Fix isMainCacheable() logic for non-content languages

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

Catrope updated the task description. (Show Details)Jul 19 2019, 11:58 PM
Catrope updated the task description. (Show Details)
Catrope added a comment.EditedJul 20 2019, 1:32 AM

To illustrate this problem, see this xhgui analysis of a cold-cache request for the startup module on mediawikiwiki in de-ch. Highlights:

  • It took 18.2 seconds the first time (cold cache) and 11.8 seconds the second time (hot cache); for lang=en this was 1.4s / 1.1s
  • 85% of the cold-cache time (15.4 seconds) was spent in Message::fetchMessage and the things called from it;
  • There are 6381 calls to MemcachedPeclBagOStuff::doMulti collectively taking 4.1 seconds, and 3190 calls to DatabaseMysqli::doQuery collectively taking 2.1 seconds

Change 524626 merged by jenkins-bot:
[mediawiki/core@master] MessageCache: Fix isMainCacheable() logic for non-content languages

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

Krinkle closed this task as Resolved.Jul 22 2019, 7:53 PM

Change 530690 had a related patch set uploaded (by Krinkle; owner: Catrope):
[mediawiki/core@REL1_33] MessageCache: Fix isMainCacheable() logic for non-content languages

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

Change 530690 merged by jenkins-bot:
[mediawiki/core@REL1_33] MessageCache: Fix isMainCacheable() logic for non-content languages

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