Measuring WordPress speed

Written: 9.12.2017 Updated: 22.12.2017

Improving the performance of WordPress sites is a popular topic among WordPress developers. E-commerce owners know that faster websites mean more conversions and more sales. Everybody hates to wait for pages that take long to load. However, the knowledge how to correctly improve the performance of WordPress sites is still surprisingly scarce.

The most basic and most central skill is how to measure the current speed of a WordPress site. Developers who don’t know how to measure the speed of their code or site, have a slim chance of making anything faster. Trying our 10 things that might (and mostly might not) improve a site is a waste of time and depends on luck of striking something that matters.

For WordPress, the most basic measurement is to time how long it takes for PHP to produce the HTML output. The most straightforward way to test any site anywhere is to use the command line tool curl. Just install the package (e.g. apt install curl in Debian based Linux machines) and run curl while printing the time_total value:

curl -s -o /dev/null -w "%{time_total}\n"

This means that the site took 123 miliseconds to load from the server to the machine running curl. To avoid the network lag between the server and your own computer, simply log into the server using ssh and run the curl to cut out all network hops in the middle.

If the WordPress site is running in a professional server environment, there will be some caching layers between the site and the world outsite. This caching layer will deliver the HTML content much faster than PHP would. To make sure you always get the response all the way from PHP, you need to burst the cache layer using the No-Pragma header (this is the same header your browser emits when you press Ctrl+F5).

curl -s -o /dev/null -w "%{time_total}\n" -H "Pragma: no-cache"

Some times the PHP execution will not be identical on every page load, or the server environment might be noisy. To make multiple measurements and get the average response time, you can use some for and awk scripting:

for i in {1..20}
 curl -so /dev/null -w "%{time_total}\n"
done | awk '{ sum += $1; n++; print $1 } END { if (n > 0) print "AVG: " sum / n; }'

AVG: 0.1378

Finally, if you have SSH access to the server and wp-cli is installed, you can disable one plugin at a time with this handy bash script snippet to see if there iss a single plugin that drastically affects the PHP page load time:

for p in $(wp plugin list --fields=name --status=active)
  echo $p
  wp plugin deactivate --skip-plugins $p
  for i in {1..5}
    curl -so /dev/null -w "%{time_total}\n" \
    -H "Pragma: no-cache"
  wp plugin activate $p 

We like to preach about WordPress performance. Making websites faster does not only make the world run more smoothly, it actually also saves computer processing power and electricity, and thus helps to save the world!

Below are the slides from WordCamp Athens where you can find more information about the topic.

3 comments on “Measuring WordPress speed”

Leave a comment

Otto Kekäläinen




More reading

New Singapore cluster available


We have good news to our current and potential customers doing business in Asia – from now on Seravo offers […]

WP-CLI v2.3 released


WP-CLI is a great tool which we use heavily at Seravo and if you are a developer we hope you […]

Translating WordPress


About a third of the websites in the world are currently running on WordPress. Behind the success of the platform […]