Page MenuHomePhabricator

meta=messagegroups (QueryMessageGroupsActionApi) is very high on response time but doesn't support pagination
Closed, ResolvedPublic4 Estimated Story PointsSecurity

Description

Extension:Translate's QueryMessageGroupsActionApi module (action=query&meta=messagegroups) takes more than 20 seconds to respond with default parameter set on mediawiki.org (link; the wiki itself can be generalised as a wiki with the Translate extension, page translation enabled, and simply a large number of translatable pages, meaning a large number of message groups). It seems it's possible to push it as far as 35 seconds if all properties (mgprop) are queried.
The high wall time appears to result from a lot of network roundtrips from unbatched SQL and memcached/Redis queries that are done separately for each group (spanning MessageCache, LinkCache, Title::getPageLanguage and probably others at least for the default parameter set). High wall time appears present even with warm caches due to WAN cache network roundtrips.

The resultset should probably be paginated (after all, if a wiki has 30k translatable pages, this single response will try to include all 30k pages). Ideally the queries themselves would be reduced with batching. (Maybe it's possible to do it dirty and split the message group objects into chunks, and warm-up LinkCache + MessageCache).

Creating this ticket through the security issue form as this might be a possible DoS vector via PHP-FPM worker process exhaustion. Whether it actually can be considered that, I'm not sure and it might be debatable. This issue is not compute or DB-intensive.

Event Timeline

https://performance.wikimedia.org/excimer/profile/c7c88c41fe221be4 has a profile. Lots of low hanging fruit here, though some not so low because this is mostly about the WikiPageMessageGroup.

For comparison later, this is how it looks currently before optimization:

image.png (3,836×2,063 px, 1 MB)

sbassett subscribed.

Leaving to @Nikerabbit. I think this could likely be made public as well, unless folks have reservations about that.

Nikerabbit changed the point value for this task from 2 to 4.

Apparently it is not possible to backport the fix to wmf.19 yet. That's why added this as a train blocker.

brennen raised the priority of this task from Medium to Unbreak Now!.Mar 10 2026, 5:02 PM
brennen subscribed.

Raising priority to UBN as a train blocker.

Apparently it is not possible to backport the fix to wmf.19 yet. That's why added this as a train blocker.

For clarity, which patch?

Raising priority to UBN as a train blocker.

Apparently it is not possible to backport the fix to wmf.19 yet. That's why added this as a train blocker.

For clarity, which patch?

I think Niklas means https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Translate/+/1249937 a cherry-pick of https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Translate/+/1249908

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Translate/+/1249266 and https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Translate/+/1249289 both landed into wmf.19 already.

Nikerabbit lowered the priority of this task from Unbreak Now! to Medium.Mar 11 2026, 7:34 AM

Thanks for deploying.

And profile after the fixes:

image.png (3,839×2,067 px, 1 MB)

Fixes are effective. The module itself takes now 400 ms with default settings. Not the fastest but fast enough I think.

With all props enabled, there are few slow ones that could still be optimized:

image.png (3,839×2,067 px, 809 KB)

Change #1250555 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] QueryMessageGroupsActionApi: fix metadata preloading

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

Change #1250554 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] QueryMessageGroupsActionApi: optimize subscription status

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

@Nikerabbit - Is anything else here preventing this task from being made public? Thanks.

No, but I'd like to verify the issue is fully mitigated first.

No, but I'd like to verify the issue is fully mitigated first.

Ok, sounds good, thanks.

sbassett changed Author Affiliation from N/A to WMF Product.Mar 17 2026, 5:11 PM
sbassett changed the visibility from "Custom Policy" to "Public (No Login Required)".
sbassett changed the edit policy from "Custom Policy" to "All Users".
sbassett changed Risk Rating from N/A to Medium.
sbassett changed Author Affiliation from WMF Product to Wikimedia Communities.