WordPress performance quick start guide

 

Solving WordPress performance issues is what WP Intense is all about. Here’s what our founder has to say:

Fast websites make more money. When I optimise WordPress websites for clients, conversions go up, pages viewed per user go up, customer lifetime value increases and even inbound traffic from SEO gains a boost.

Dave Hilditch – founder, WP Intense

How to identify your WordPress performance problems

So far, you’ve probably used GTMetrix or Pingdom or some other tool to scan your site. This tool will have told you to minify your CSS, compress or resize your images, remove blocking javascript and join javascript files together to make them quicker to download.

But you still have a slow site, so what figures? Speed-testing tools can’t see the activity that’s happening on your server. If you still have a slow site, it’s because you have a large TTFB. That’s Time To First Byte. In human, it’s your raw page speed, the amount of time between when the page was requested and the first response comes back from the server.

A long TTFB not only hurts individual page speed, it also hurts your ability to scale. There’s only so much server resource available, so if your TTFB is 4 seconds – instead of 100 milliseconds, that means you can handle 40 times less traffic capacity – fewer simultaneous users on your site. Worse, as more people arrive to your site, your TTFB is going to increase significantly as your server thrashes about trying to serve up pages.

To be able to view your TTFB on every page of your site, and to spot the sources of performance problems, install the Query Monitor plugin.

Caching

The most critical thing you can do immediately is to sort out your caching. Caching does not need to be complicated – there are 2 key things you need:

1) Page Cache

If you have a large TTFB, you should set up page caching immediately. This will mean the 2nd+ visitors to a page will get a TTFB of 100ms or less. It will also free up server resource so that the TTFB can drop for other pages – instead of your server generating 100 pages, a unique page per user every time, with page-caching, it only needs to generate 10. That gives you 10x more capacity right there.

Note: These figures are totally dependent on how many pages are re-used by your visitors. If they’re all concentrated on one page, you’ll see MASSIVE improvements with page-caching. If they are spread out over hundreds or thousands of pages, you’ll see less benefit.

For page caching you can use the WP-Rocket plugin. It’s the easiest to use. If you feel more confident, you can use the W3 Total Cache plugin for your page caching.

Direct Links

2) Object Cache

WordPress plugins are getting better at using the object cache properly, so get Redis installed onto your hosting (most hosting offers it) and configure your object cache. As you move from page to page, if you have the Query Monitor plugin running, you’ll see the number of queries used per page dropping.

Object caching eliminates repeated SQL queries *and* repeated PHP code to manipulate the results of these queries into a PHP object. That means you’re reducing disk usage and CPU usage.

For Object caching you can use the Redis Cache plugin, or if you’re using W3 Total Cache you can enable it in there.

Direct Links

WooCommerce Shortcodes, Attribute widget and Price widget

If you’re using WooCommerce shortcodes (products on sale, best sellers, most popular products) or the WooCommerce attribute or price widgets then you’ll be seeing a very high query count in Query Monitor on your slow pages. Object caching should help, but you’ll still have slow first page loads for many of your pages. You may not know you’re using these shortcodes – if, for example, you’re using a page builder like VS Composer then they may have inserted the shortcodes for you, or they may even be built into your theme options.

Consider removing the shortcodes or replacing them with our fast ones.

Our Faster Woo Widgets plugin and Super Speedy Sale Page for WooCommerce can help you.

Direct Links

Imports

If you have slow imports, our Scalability Pro plugin can help, especially once your store gets larger, but you should also check out our article on the WordPress image sizes problem. All the plugins you’ve installed over time, many of them have registered new image sizes. It’s not uncommon for websites to have 30 image sizes registered. That means, when you import something, the image for it will be resized into 30 different sizes and stored in your uploads folder. That’s a lot of extra CPU for resizing and a lot of disk for storing the images.

Check out our guide to speeding up imports by eliminating unused image sizes.

If you would like even faster imports, check out our Scalability Pro plugin.

Direct Links

  • Scalability Pro – by WP Intense – speeds up product lookup and other slow-running import-related queries
  • External Images plugin – by WP Intense – eliminates the need to store featured images on your server, speeding up imports and reducing storage requirements
  • WP All Import – the only multi-purpose import plugin we recommend because it’s the only one we’ve found that performs and scales
  • Datafeedr – a great import tool if you’re building an affiliate store

A separate note on scraping

If you wish to import products by scraping them from other sites, you can do so. The easiest way is to use any of these scraping tools below to generate a URL containing the scraped data. Then pass that URL to WP All Import and drag/drop the fields to your destination posts or products.

Hosting

Your host doesn’t really matter. What matters is the stack they provide you. Here are the key essentials you need:

  • SSD disks (not HDD)
  • 1GB ethernet (not 100Mbps)
  • PHP 7+ (not PHP 5.6)
  • MariaDB or PerconaDB or MySQL 8 (not MySQL 5.6)
  • Redis in cache mode (for your object cache)
  • Nginx scales better than Apache, but this is less relevant than the other items above
  • An HTTP accelerator – it could be varnish, or nginx fastcgi_cache or some other accelerator. Cloudflare can also help here or MaxCDN too.
  • A CDN – like Cloudflare or MaxCDN. Use their features to compress and minify your CSS and to change browser expiry dates for static files to a year from now.

We recommend the following hosts, but any that provide the above items will do:

Affiliate Links

Direct Links

Upgrading your current hosting

From the list above, if you have PHP5.6 get that upgraded now! PHP 7+ is 3x faster than PHP5.6. If you have a lot of PHP time being used on your site, this will make a massive impact.

Second would be getting Redis for your object cache.

Third would be upgrading to MySQL 8 or MariaDB.

Fourth would be adding a CDN.

If after all that, your speed is acceptable, then it’s ok to stay with your current hosts.

If you are thinking of moving hosts, go for WP Engine if you want your hand held and all the performance worries dealt with, or with Digital Ocean and one of our stacks if you want control and most bang for your buck.

Improving your page generation speed

Page-caching can’t help you much if you have 1000s of pages. Googlebot will not be getting the cached page, as it does not behave like a user and instead trawls through every page. There are two key issues that cause slow page generation speed.

Too many SQL queries

You may find that as your tables get larger, the number of queries per page increases. This is because some plugins are badly coded and even though they’re only displaying 20 items, they process every item in your database. This includes the official WooCommerce shortcodes for products on sale, best selling products, most popular products and it includes the official attribute widget and the official price filter widget from WooCommerce.

Object caching can help reduce the number of queries, but really you should either eliminate these shortcodes and/or widgets, or replace them with superior shortcodes/widgets that do not case an increase in SQL queries as your DB size increases.

Direct Links

You can find links to the Redis Cache plugin and W3 Total Cache plugin above.

Slow SQL queries

If you have a large database with large order volume, or large product volume, or large comment volume, or large user counts, then queries will get slower and slower as your site grows. This is because of something called ‘table scans’. I’ve discussed this before on stack overflow.

We built the plugin Scalability Pro specifically to solve and eliminate table scans. It does this by adding good indexes to tables and rewriting some queries to ensure they use the indexes.

Direct Links

Further Reading

We have tons of guides here on WP Intense. Our mission is to make performance and scalability easy for everyone. We still have a long way to go, but we’re definitely helping.

You can view our other article categories using the link below:

View WP Intense article categories