Jump to content

MediaWiki-Docker/Configuration recipes/Profiling

From mediawiki.org

Plaintext profiler

[edit]

MediaWiki-Docker comes with php-tideways pre-installed, which provides support for profiling web requests and maintenance scripts. This result is the same as in production with WikimediaDebug#Plaintext_request_profile.

Add once to LocalSettings.php:

// Use ?forceprofile=1 to profile the request.
// Output is added to the end of the response (use view-source if the response is HTML).
if ( extension_loaded( 'tideways_xhprof' ) ) {
	if ( isset( $_GET['forceprofile'] ) || PHP_SAPI === 'cli' ) {
		$wgProfiler = [
			'class'  => ProfilerXhprof::class,
			'flags'  => TIDEWAYS_XHPROF_FLAGS_CPU | TIDEWAYS_XHPROF_FLAGS_NO_BUILTINS,
			'output' => 'text',
		];
	}
}

Flame graph

[edit]

MediaWiki-Docker does not yet come with Excimer installed. To install it one time, follow Excimer#MediaWiki-Docker installation steps.

Then, to enable it in LocalSettings, refer to the recipe at Excimer#Per-request flame graph from MediaWiki.

Code steward

[edit]