Page MenuHomePhabricator

Check Wikibase services for expensive setup patterns (db & api calls etc) & fix / remove
Closed, ResolvedPublic

Description

T243725: HtmlPageLinkRendererBeginHookHandler creates a LanguageFallbackChain when it may not be needed highlights one particular issue.
Along with this being fixed other services should also be checked for similar patterns and fixed where needed.
Documentation should be updated to highlight this pattern to be avoided.

Event Timeline

Addshore created this task.Jan 26 2020, 9:50 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 26 2020, 9:50 PM
Addshore triaged this task as High priority.Jan 26 2020, 9:50 PM
Addshore moved this task from Incoming to Ready to pick up on the Wikidata-Campsite board.

I have some ideas about this but xhgui is down :( https://performance.wikimedia.org/xhgui/ I will try later.

Addshore renamed this task from Check Wikibase services for expensive setup patterns & fix to Check Wikibase services for expensive setup patterns (db & api calls etc) & fix / remove.Jan 30 2020, 9:16 AM

So this taks still needs to look for the same pattern of service construction where one of the things injected into the service ends up doing dB calls or API calls (what was happening with the language fallback chain issue).
Less of a profiling thing and more of a looking by eye thing.
Might be able to do something clever actually where a test replaces the db layer and http call later and calls all of the wikibase repo getters, making sure no http or SQL calls are done.

Change 571318 had a related patch set uploaded (by Hoo man; owner: Hoo man):
[mediawiki/extensions/Wikibase@master] Assert service getters never access the DB/ do http requests

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

Change 571318 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Assert service getters never access the DB/ do http requests

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

Change 571474 had a related patch set uploaded (by Hoo man; owner: Hoo man):
[mediawiki/extensions/Wikibase@master] Test that factory methods don't access the DB/ do http requests

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

Change 571474 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Test that factory methods don't access the DB/ do http requests

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

We now have fairly conclusive test coverage of this (covers all from-global-state-factory methods I could find), so I think we can consider this done.

Very nice tests for this case :)
We probably also need to do this for the services held withing WikibaseRepo->getWikibaseServices which holds currently another 10 services.

Change 572664 had a related patch set uploaded (by Hoo man; owner: Hoo man):
[mediawiki/extensions/Wikibase@master] Make sure WikibaseServices services getters don't access the DB

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

Change 572664 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Make sure WikibaseServices services getters don't access the DB

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

Addshore closed this task as Resolved.Mar 4 2020, 4:11 PM