Krinkle created this task.
Krinkle added projects: Performance-Team, MediaWiki-extensions-WikibaseClient, Wikidata.
Herald added a subscriber: Aklapper.

TASK DESCRIPTION

/includes/WebStart.php

  • EchoHooks::initEchoExtension (3.05%)
    • Wikibase\Client\Hooks\EchoNotificationsHandlers::onBeforeCreateEchoEvent
    • Wikibase\Client\Hooks\EchoNotificationsHandlers::newFromGlobalState (2.63%)
	public static function onBeforeCreateEchoEvent(
		array &$notifications,
		array &$notificationCategories,
		array &$icons
	) {
		$self = self::newFromGlobalState();
		$self->doBeforeCreateEchoEvent( $notifications, $notificationCategories, $icons );
	}

For example: https://performance.wikimedia.org/xenon/svgs/daily/2017-10-01.load.svgz
F9984501: Screen Shot 2017-10-03 at 19.24.12.png

The doBeforeCreateEchoEvent() method call itself is trivial. Most time is spent in newFromGlobalState(), which requires numerous services that are not used.

  • NamespaceChecker (unused)
  • RepoLinker (unused)
  • WikibaseClient (mostly unused, except for Settings)
    • WikibaseClient//SiteLookup (unused)
    • WikibaseClient//DataTypeDefinitions (unused)
    • WikibaseClient//Settings (used)

The most expensive here is SiteLookup and NamespaceChecker, which are both created here for the unrelated hook onWikibaseHandleChange - which is not called on most requests and not worth blocking WebStart on all web requests.

From a brief look it seems that the main problem is that all hook handlers share the same singleton for injection (instead of obtaining their own services as needed), which means calling one hook ends up also requiring services for other hooks.

A deeper problem is that these services have expensive constructors, which is unexpected, and likely the reason why this approach was assumed to be unproblematic.


See also: T160678: Reduce ChronologyProtector init cost for load.php


TASK DETAIL
https://phabricator.wikimedia.org/T177311

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Krinkle
Cc: aude, thiemowmde, Krinkle, Aklapper, GoranSMilovanovic, QZanden, Vali.matei, Izno, Wikidata-bugs, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to