Improving WordPress Performance with Xdebug and PHP Profiling

The success of WordPress is traditionally attributed to how easy it is to use, both from an end-user point of view and from a website developer’s point of view. Many feel empowered by WordPress as they are able to produce good-looking and functional sites with relatively little work. The flexibility of WordPress means it does not enforce quality, and WordPress sites using a lot of different plugins traditionally suffer from security and performance issues.

Because of this the web is full of all kinds of articles on how to improve WordPress speed performance and security. Unfortunately most of those articles are just listings like “do these 10 things to improve your WordPress site” and they categorically lack any evidence of what effect the suggested actions have. Some of the advice out there is even plain wrong, and does not yield the desired result at all.

At Seravo we want to help the entire WordPress community evolve. We’ve debunked WordPress security myths by giving talks about WordPress security at many WordPress Meetups and WordCamps. Now it is time to dig deeper into performance and speed.

Xdebug and Webgrind

At WordCamp Europe 2017 I delivered a talk about WordPress speed performance, hoping to spread good evidence based on practices among WordPress plugin and theme developers.

For PHP, the programming language used in WordPress, there exists an excellent tool called Xdebug. It profiles the execution flow of PHP and greatly helps to find performance bottlenecks.

Xdebug is easy to install following the instructions in the presentation below, or if you are using the Seravo WP Vagrant image, Xdebug and Webgrind for visualizations are already there ready to use, just see seravo.com/docs/development/xdebug/ to start using it.

Xdebug works by instrumenting every single PHP function call and by logging what function calls what other functions and how long each function takes to execute. This data is stored in a text file called cachegrind and can be opened in any compatible program. Our preference is Webgrind, as it works in the browser and suites web developers well.

For more details, see the presentation slides below or the whole presentation on WordPress TV (waiting to be published).

Looking for professional hosting?

When you want to rest easy at night, it is essential that you have chosen hosting solution whose expertise you can trust. Seravo is more than a hosting company – we also keep your site updated, safe from attacks and can advice you on any development and performance issues that might concern you.