Set up request profiling for PHP 7
Open, NormalPublic

Description

For request profiling in debug requests we currently use HHVM's built-in XHProf extension in a number of ways:

  • Capture one-off profiles and send to XHGui at https://performance.wikimedia.org/.
  • Capture one-off profiles and send to stdout, via MediaWiki's Profiler and ProfilerOutput interfaces.

See also https://wikitech.wikimedia.org/wiki/X-Wikimedia-Debug for details.

The logic for XHGui is in wmf-config/profiler.php. (Basically, just xhprof_enable/disable.)

The logic for MediaWiki is in core, and currently supports php-xhprof (PHP 5.x), php-tideways (PHP 5.x and PHP 7.x) and HHVM's XHProf.

Links:

Before we can switch from HHVM to PHP 7, we need to decide which extension to use for PHP debug profiling.

Options:

Krinkle created this task.Oct 3 2018, 6:12 PM
Krinkle triaged this task as Normal priority.
Joe added a comment.Mon, Dec 3, 9:13 PM

php-tideways is packaged in debian stretch, and although we will need to rebuild it (to add php 7.2 support), it should be pretty straightforward. AIUI, it should allow us to continue using the same tooling as before.

Krinkle claimed this task.Wed, Dec 5, 4:43 PM

Please install tideways, but it should only be enabled in php.ini on the debug servers, since it will cause a performance degradation even without being used. Also, please install php-mongodb, the PHP driver for MongoDB, since this is recommended for XHGui saving on PHP 7. I am working on the mediawiki-config patch which will use these extensions.

Joe added a comment.EditedFri, Dec 7, 7:15 AM

Please install tideways, but it should only be enabled in php.ini on the debug servers, since it will cause a performance degradation even without being used. Also, please install php-mongodb, the PHP driver for MongoDB, since this is recommended for XHGui saving on PHP 7. I am working on the mediawiki-config patch which will use these extensions.

For now I'll just install/enable them on the debug servers, which will then merit their own separate role.

Mentioned in SAL (#wikimedia-operations) [2018-12-07T17:15:50Z] <_joe_> uploading php-tideways (rebuilt with php 7.2 support) to stretch-wikimedia thirdparty/php72 T206152

Change 478594 had a related patch set uploaded (by Giuseppe Lavagetto; owner: Giuseppe Lavagetto):
[operations/puppet@production] profile::mediawiki::php: install php-tideways, php-mongodb

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

Joe added a comment.Mon, Dec 10, 1:38 PM

I did some benchmarks , using the same setup I used for T206341, with tideways enabled and disabled. I could not notice any clear trend besides a slight variance due probably to external factors.

See the graphs collected here https://people.wikimedia.org/~oblivian/T206341/tideways/images/ for reference. I am in favour of enabling it everywhere, unless there is some non-performance-related concern.

Mentioned in SAL (#wikimedia-operations) [2018-12-10T14:50:29Z] <_joe_> uploading php-mongodb 1.5.3 to stretch-wikimedia thirdparty/php72 T206152

Change 478594 merged by Giuseppe Lavagetto:
[operations/puppet@production] profile::mediawiki::php: install php-tideways, php-mongodb

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