Page MenuHomePhabricator

Make MediaWiki profiler in Beta match production
Closed, ResolvedPublic

Description

None of the usual profiler triggers seem to work on Beta Cluster.

  • Set ?forceprofile=1 on an index.php, api.php or load.php request with X-Wikimedia-Debug: 1 to get a profile in plain text as part of the response. E.g. /load.php?modules=startup&forceprofile=1.
    • Depends on StartProfiler or CommonSettings setting $wgProfiler.
  • Set --profiler=text on a maintenance script to get plain text profile. E.g. PHP=hhvm mwscript showJobs.php --wiki=aawiki --profiler=text
    • Depends on StartProfiler or CommonSettings setting $wgProfiler.
  • Set X-Wikimedia-Debug: 1; profile to send a profile to XHGui.
  • Xenon sampling profiler publishing a Redis on the mwlog host to produce and publish aggregated flame graphs.

From a quick look it seems the production StartProfiler.php is not used by Beta Cluster (scap doesn't create the bootstrap file for php-master). But CommonSettings-labs.php does contain some outdated code relating to $wgProfiler but it doesn't look for the usual signals (CLI, XWD, forceprofile, etc.). It's only for Beta Cluster's test wiki.

Details

Related Gerrit Patches:
operations/mediawiki-config : masterscap prep: Scap-ify the creation of beta's StartProfiler.php
operations/mediawiki-config : masterlabs: Remove dead profiler-related code from CommonSettings-labs.php
operations/mediawiki-config : masterInitial profiler for Beta Cluster
operations/mediawiki-config : masterlabs: Enable profiler based on same signals as production does
operations/mediawiki-config : masterlabs: Clean up outdated wgProfiler config

Event Timeline

Krinkle created this task.Nov 17 2017, 12:55 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 17 2017, 12:55 AM

Change 391982 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[operations/mediawiki-config@master] labs: Clean up outdated wgProfiler config

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

Change 391987 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[operations/mediawiki-config@master] labs: Enable profiler based on same signals as production does

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

Krinkle updated the task description. (Show Details)

Change 391982 merged by jenkins-bot:
[operations/mediawiki-config@master] labs: Clean up outdated wgProfiler config

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

Change 391987 merged by jenkins-bot:
[operations/mediawiki-config@master] labs: Enable profiler based on same signals as production does

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

After these patches it still isn't working.

Compare

test.wikimedia.beta
$ curl -i 'https://test.wikimedia.beta.wmflabs.org/w/load.php?modules=startup'
mw.loader.implement("startup@127dy99",function($,jQuery,require,module){});
/*
100.00% 689.012      1 - main()
 88.86% 612.283      1 - ResourceLoader::respond
 [ .. ]
*/
en.wikipedia.beta
$ curl -i -H 'X-Wikimedia-Debug: 1' 'https://en.wikipedia.beta.wmflabs.org/w/load.php?modules=startup&forceprofile=1'
mw.loader.implement("startup@127dy99",function($,jQuery,require,module){});

Probably because the configuration is set too late. We need an actual StartProfiler.php file for Beta.

Gilles assigned this task to Krinkle.Nov 20 2017, 9:16 PM
Gilles moved this task from Inbox to Next In This Quarter on the Performance-Team board.
Krinkle triaged this task as High priority.Nov 20 2017, 9:16 PM

Change 403974 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[operations/mediawiki-config@master] Initial profiler for Beta Cluster

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

Change 403974 merged by jenkins-bot:
[operations/mediawiki-config@master] Initial profiler for Beta Cluster

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

Krinkle removed a project: Patch-For-Review.EditedJan 31 2018, 2:50 AM
Krinkle updated the task description. (Show Details)
Krinkle updated the task description. (Show Details)

Change 403974 merged by jenkins-bot:
[operations/mediawiki-config@master] Initial profiler for Beta Cluster
https://gerrit.wikimedia.org/r/403974

I've also created /srv/mediawiki/php-master/StartProfiler.php in deployment-prep as link to /srv/mediawiki/wmf-config/StartProfiler-labs.php, matching the setup we have for production.

Confirmed that, as of now:

  • Profiler from CLI works (see task description)
  • Profiler from web works (see task description)

Tested profiling from web via cURL. To use X-Wikimedia-Debug, that browser extension needs to be fixed to also send the header on Beta Cluster urls. (Edit: This is fixed per WikimediaDebug#12, and released in v1.9.1)

Krinkle closed this task as Resolved.Jan 31 2018, 3:00 AM
Krinkle moved this task from Backlog: Small & Maintenance to Doing on the Performance-Team board.

Closing as this unblocks the parent task. The remaining work is separated into T180761: Move XHGui from tungsten to webperf-002.

Change 414906 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[operations/mediawiki-config@master] labs: Remove dead profiler-related code from CommonSettings-labs.php

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

Change 414906 merged by jenkins-bot:
[operations/mediawiki-config@master] labs: Remove dead profiler-related code from CommonSettings-labs.php

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

Change 416334 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[operations/mediawiki-config@master] scap prep: Scap-ify the creation of beta's StartProfiler.php

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

Change 416334 merged by jenkins-bot:
[operations/mediawiki-config@master] scap prep: Scap-ify the creation of beta's StartProfiler.php

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