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:
- https://pecl.php.net/package/xhprof / https://github.com/phacility/xhprof
- Originally facebook/xhprof, now phacility/xhprof. Not much activity, but maybe it's just stable. (issue)
- Supports PHP 5.x only, but there's an experimental branch for PHP 7 support.
- HHVM also includes a port of XHProf, which is what we currently use in production.
Before we can switch from HHVM to PHP 7, we need to decide which extension to use for PHP debug profiling.
Options:
- phacility/xhprof:experimental (see https://github.com/phacility/xhprof/tree/experimental).
- tideways/tideways_xhprof (see https://github.com/tideways/php-xhprof-extension).
- ... something else?