Page MenuHomePhabricator

Switch wmf-config/Profiler from Tideways to XHProf
Closed, ResolvedPublic

Description

The code in mediawiki-config.git:/wmf-config/Profiler.php currently calls Tideways to implement the "XHGui" and "Inline profile" features of WikimediaDebug.

Following T400109: Ensure MediaWiki-Core-Profiler works with php-xhprof 2.x (PHP 8.3), SRE has packaged php-xhprof at T398245, so we need to update the MW config in production to activate xhprof instead of tideways_xhprof.

This patch should be written by MediaWiki Platform Team, and deployment coordinated with SRE ServiceOps, so that it can happen directly after they promote the updated k8s-mwdebug Docker image that swaps php-tideways_xhprof for php-xhprof.

Related Objects

Event Timeline

Krinkle updated the task description. (Show Details)
Krinkle updated the task description. (Show Details)

Thanks for filing this @Krinkle.

So, for the production use case, the switch from installing php-tideways to php-xhprof should be as simple as updating the respective make-container-image Dockerfiles for the cli and debug images.

As long as the updated Profiler.php remains similarly "conditionally active" - i.e., conditioned on the return value of extension_loaded - then we have a lot of freedom on how we can coordinate this. If desired, we can even deploy them immediately after merging the make-container-image changes, which would then pick up both in the same scap invocation (i.e., no period where profiling isn't available due to a missing extension).

As for non-k8s use cases:

  • The mwdebug servers, which are the sole production use of profile::mediawiki::php::enable_request_profiling: true (i.e., what triggers tideways to be installed), are being turned down and thus no longer relevant here.
  • However, as for non-production use cases, it seems this is enabled everywhere in beta. To continue to support profiling there, the relevant puppet code will need updated in some sensible way.

Change #1175620 had a related patch set uploaded (by Krinkle; author: Krinkle):

[operations/mediawiki-config@master] Profiler: Support php-xhprof besides php-tideways-xhprof

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

Change #1175621 had a related patch set uploaded (by Krinkle; author: Krinkle):

[operations/mediawiki-config@master] Profiler: Remove support for php-tideways_xhprof

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

Change #1175623 had a related patch set uploaded (by Krinkle; author: Krinkle):

[operations/puppet@production] mediawiki: install php8.1-xhprof

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

Change #1175620 merged by jenkins-bot:

[operations/mediawiki-config@master] Profiler: Add php-xhprof support besides php-tideways_xhprof

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

Mentioned in SAL (#wikimedia-operations) [2025-08-05T16:53:54Z] <krinkle@deploy1003> Started scap sync-world: Backport for [[gerrit:1175620|Profiler: Add php-xhprof support besides php-tideways_xhprof (T401152)]]

Mentioned in SAL (#wikimedia-operations) [2025-08-05T16:55:40Z] <krinkle@deploy1003> krinkle: Backport for [[gerrit:1175620|Profiler: Add php-xhprof support besides php-tideways_xhprof (T401152)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

  • Apply https://gerrit.wikimedia.org/r/c/1175623 (Puppet) in Beta Cluster. Which uninstalls php8.1-tideways_xhprof, and installs php8.1-xhprof. At this point, WikimediaDebug with XHGui is a no-op (the permalink at performance.wikimedia.beta.wmcloud.org/xhgui shows no results).
  • Initiate scap backport for https://gerrit.wikimedia.org/r/1175620 (wmf-config).
    • Once merged, git pull in krinkle@deployment-deploy04:/srv/mediawiki-staging, scap pull on krinkle@deployment-mediawiki14, and confirm krinkle@deployment-mediawiki14:~$ cat /srv/mediawiki/src/Profiler.php | grep xhprof.
    • Verify that WikimediaDebug now works again in Beta Cluster, using php-xhprof.
  • Once the scap backport is on testserver, verify via mwdebug in prod that WikimediaDebug/XHGui still works there via php-tideways_xhprof.

Next steps:

  • Swap tideways package for xhgui in mwdebug image.
  • Verify that WikimediaDebug/XHGui still works, now using xhprof.
  • Remove tideways handling in wmf-config.

Mentioned in SAL (#wikimedia-operations) [2025-08-05T17:05:09Z] <krinkle@deploy1003> Finished scap sync-world: Backport for [[gerrit:1175620|Profiler: Add php-xhprof support besides php-tideways_xhprof (T401152)]] (duration: 11m 15s)

Mentioned in SAL (#wikimedia-operations) [2025-08-05T17:07:02Z] <swfrench@deploy1003> Started scap sync-world: Migrate debug and cli images to xhprof - T401152

Mentioned in SAL (#wikimedia-operations) [2025-08-05T17:08:40Z] <swfrench@deploy1003> swfrench: Migrate debug and cli images to xhprof - T401152 synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-08-05T17:28:43Z] <swfrench@deploy1003> Finished scap sync-world: Migrate debug and cli images to xhprof - T401152 (duration: 22m 02s)

Change #1175623 merged by Scott French:

[operations/puppet@production] mediawiki: install php8.1-xhprof on beta cluster and mwdebug

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

Change #1175621 merged by jenkins-bot:

[operations/mediawiki-config@master] Profiler: Remove support for php-tideways_xhprof

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

Mentioned in SAL (#wikimedia-operations) [2025-08-05T18:46:17Z] <krinkle@deploy1003> Started scap sync-world: Backport for [[gerrit:1175621|Profiler: Remove support for php-tideways_xhprof (T401152)]]

Mentioned in SAL (#wikimedia-operations) [2025-08-05T18:48:04Z] <krinkle@deploy1003> krinkle: Backport for [[gerrit:1175621|Profiler: Remove support for php-tideways_xhprof (T401152)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-08-05T19:01:11Z] <krinkle@deploy1003> Finished scap sync-world: Backport for [[gerrit:1175621|Profiler: Remove support for php-tideways_xhprof (T401152)]] (duration: 14m 54s)