#StandWithUkraine

How to profile WordPress performance with WP Tuner

[update] This plugin is no longer maintained by the author and breaks recent WordPress versions.

When you tinker with ready-made engine such as WordPress it is often unobvious what is going on inside. Seemingly simple actions can call cascades of functions and database queries under the surface.

WP Tuner is a plugin for developers and power users that allows to precisely monitor how page is generated and resources are consumed.

What it does

Plugin attaches itself to WordPress page generation cycle and logs:

  • time spent;
  • CPU load (if on Linux server);
  • database queries;
  • memory usage.

wp_tuner_interface

Results are displayed at the bottom of each page, visible only to logged in administrators. Performance bottlenecks (events that take longer than threshold, specified in settings) are automatically highlighted.

Add own markers

Markers in result table show statistics up to next marker. Meaning there can be plenty of stuff running in between default checkpoints.

Most important feature is that WP Tuner supports additional markers. They can be added to WordPress actions:

add_action(‘action', 'wpTuneFilterTime' );

or at any point in code:

if (function_exists(wpTuneMarkTime)) wpTuneMarkTime('mark');

Strong features

Collected data is organized in several highly useful tables (which are shown can be selected in options):

  • page generation – shows how page is generated from mark to mark and how resources and time are distributed;
  • database performance – shows which files (WP core, current theme, plugins, etc) make database calls, how many and how fast;
  • database tables – shows which WP tables get queried;
  • query analysis – shows how specific queries work and consume resources.

Downsides

Aside from some minor usability issues (style sheet could be more bulletproof) my only gripe so far that it is hard to distinguish between multiply loops in page. Page generation info could use file and line numbers where marks are fired, which is technically possible.

At moment plugin isn’t actively developed, but author stated he is going to continue work on it in the future.

Overall

Excellent and unique tool to make sense of WordPress performance. Useful in many scenarios – from profiling sluggish blog to writing efficient code.

Home http://blogs.icta.net/plugins/category/plugins/wp-tuner-plugins/

Repository http://wordpress.org/extend/plugins/wptuner/

Related Posts

5 Comments

  • Optimizing Freeware Genius blog performance | Rarst.net #

    [...] style sheet files;loads of inline CSS (yuck);multiply scripts;crazy amount of database queries (WP Tuner helped a lot to narrow it down).Cherry on top that because of frequent updates I couldn’t even [...]
  • Patrick Moran #

    Good post. FYI, we here at New Relic just built a free monitoring and management tool that is super easy to set up - it monitors PHP apps (including wordpress) Check it out... http://blog.newrelic.com/2010/12/16/measuring-wordpress-performance-with-new-relic-rpm/
  • Rarst #

    @Patrick Moran Bookmarked to check out. :) Sadly WP Tuner is unmaintained and broken for latest WordPress versions so there is more than enough space for profiling tools now.
  • Ashish #

    My site went down as soon as I installed the plugin. So, beware....it seems the plugin doesn't work any more.
  • Rarst #

    @Ashish Thank you for reminder, I had added note to post that plugin is unmaintained and won't work nowadays.