Page MenuHomePhabricator

Reduce ChronologyProtector init cost for load.php
Closed, ResolvedPublic

Description

A significant amount of the time in load.php is spent in MediaWiki WebStart.php, via wmf-config/CommonSettings. The biggest one within that seems to be Wikibase providing some values for an Echo hook. About 30x longer compared to Thanks, Flow and EducationProgram for the same Echo hook.

/includes/WebStart.php > EchoHooks::initEchoExtension > Wikibase\Client\Hooks\EchoNotificationsHandlers::onBeforeCreateEchoEvent (git-src)

public static function onBeforeCreateEchoEvent( .. ) {
	$self = self::newFromGlobalState();
	$self->doBeforeCreateEchoEvent( $notifications, $notificationCategories, $icons );
}

The actual call to doBeforeCreateEchoEvent() is runs too quickly to show up. It's mostly setting up the global instance. It seems some of the constructors involved do a lot of (presumably unnecessary) work in the constructor.

  • Wikibase\Client\WikibaseClient::getDefaultInstance
    • MediaWiki\MediaWikiServices::getSiteLookup
      • MediaWiki\MediaWikiServices::getSiteStore
        • MediaWiki\MediaWikiServices::getDBLoadBalancer
          • Wikimedia\Rdbms\LBFactoryMulti::getMainLB
            • Wikimedia\Rdbms\ChronologyProtector::initLB
              • Wikimedia\Rdbms\ChronologyProtector::initPositions

Event Timeline

Krinkle created this task.Mar 16 2017, 6:29 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 16 2017, 6:29 PM
Lydia_Pintscher added subscribers: hoo, aude.

Change 344573 had a related patch set uploaded (by Aaron Schulz):
[mediawiki/core@master] [WIP] Defer calling ChronologyProtector::initLB() until connecting

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

Krinkle triaged this task as Normal priority.Mar 25 2017, 2:32 AM
Krinkle moved this task from Inbox to Accepted: Enhancement on the MediaWiki-ResourceLoader board.
Krinkle moved this task from Accepted: Enhancement to Assigned on the MediaWiki-ResourceLoader board.

Change 344573 merged by jenkins-bot:
[mediawiki/core@master] Defer calling ChronologyProtector::initLB() until connecting

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