Page MenuHomePhabricator

Schema properties in client code loads the whole item in every page view
Closed, ResolvedPublic

Assigned To
Authored By
Ladsgroup
Dec 11 2020, 7:34 PM
Referenced Files
F33945418: image.png
Dec 14 2020, 10:30 AM
F33945415: image.png
Dec 14 2020, 10:30 AM
F33945420: image.png
Dec 14 2020, 10:30 AM
Tokens
"Mountain of Wealth" token, awarded by wkandek."Party Time" token, awarded by phuedx."Pirate Logo" token, awarded by Addshore."Burninate" token, awarded by Jdforrester-WMF.

Description

The code added as part of T198946: Add Schema property 'sameAs' pointing to Wikidata entries (the Go Fish SEO work) in I02bc43f16cc53. Loads the whole item of in client wikis (like English Wikipedia) in every page view request (like opening article of Alan Turing makes it load the whole item of Q2751). It even bypasses ParserCache (Tested using XHGui). FlameGraphs say it consumes 13% resources of all requests involving Wikibase (most requests) and I'm pretty sure it puts a heavy load on memcached and ES.

The offending code is in Wikibase\Client\Hooks\SkinAfterBottomScriptsHandler::createSchemaElement (being called from Wikibase\Client\ClientHooks::onSkinAfterBottomScripts)

Event Timeline

Change 648338 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[mediawiki/extensions/Wikibase@master] Avoid loading the whole item in every client page view

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

Change 648338 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Avoid loading the whole item in every client page view

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

Change 648283 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[mediawiki/extensions/Wikibase@wmf/1.36.0-wmf.21] Avoid loading the whole item in every client page view

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

Change 648283 merged by Ladsgroup:
[mediawiki/extensions/Wikibase@wmf/1.36.0-wmf.21] Avoid loading the whole item in every client page view

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

Mentioned in SAL (#wikimedia-operations) [2020-12-14T10:12:52Z] <ladsgroup@deploy1001> Synchronized php-1.36.0-wmf.21/extensions/Wikibase/client/includes: [[gerrit:648283|Avoid loading the whole item in every client page view (T269960)]] (duration: 00m 25s)

https://grafana.wikimedia.org/d/000000316/memcache?viewPanel=22&orgId=1&from=now-1h&to=now

This basically shows a 100MB/s drop in memcache traffic

image.png (913×1 px, 116 KB)

Also, a 2% increase in ratio of requests served below 250ms and 30ms drop in 95th percentile

image.png (913×1 px, 98 KB)

image.png (913×1 px, 108 KB)

Ladsgroup claimed this task.

This is done I assume?

This is happening in MobileFrontend as well....

Change 700531 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[mediawiki/extensions/MobileFrontend@master] Avoid loading the whole entity when it only needs description.

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

Change 700344 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[mediawiki/extensions/MobileFrontend@wmf/1.37.0-wmf.9] Avoid loading the whole entity when it only needs description.

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

Change 700344 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@wmf/1.37.0-wmf.9] Avoid loading the whole entity when it only needs description.

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

Change 700531 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Avoid loading the whole entity when it only needs description.

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

Mentioned in SAL (#wikimedia-operations) [2021-06-21T13:28:58Z] <ladsgroup@deploy1002> Synchronized php-1.37.0-wmf.9/extensions/MobileFrontend/includes/ExtMobileFrontend.php: Backport: [[gerrit:700344|Avoid loading the whole entity when it only needs description. (T269960)]] (duration: 00m 58s)

This is done. Unfortunately (or fortantely) the second issue didn't have much performance issues given the fact that short description from wikidata is enabled on some wikis and it's bound to ParserCache (unlike the first issue).