Wordpress claims that more than 63 million web sites are running the Wordpress software. So for a lot of users, understanding how to make Wordpress handle load is important. Optimizing Wordpress ability to handle load is very closely related to optimizing the general performance, a subject with a lot of opinions out there. We've actually talked about this issue before on this blog. Here's the top 5 things we recommend you do to fix before you write that successful blog post that drives massive amounts of visitors.
#1 - Keep everything clean and up to date
Make sure that everything in Wordpress is up to date. While this is not primarily a performance consideration, it's mostly important for security reasons. But various plugins do gradually become better and better with performance issues, so it's a good idea to keep Wordpress core, all plugins as well as your theme up to date. And do check for updates often, I have 15 active plugins on my blog and I'd say that there's 4-6 upgrades available per month on average. The other thing to look out for is to keep things clean. Remove all themes and plugins that you don't currently use. Deactivate and physically delete them. As an example, at the time of writing this. my personal blog had 9 plugins that needed upgrading and I had also let the default Wordpress theme in there. I think it's a pretty common situation so do what I did and make those upgrades.
#2 - Keep the database optimized
There are two ways that Wordpress databases can become a performance problem. First is that Wordpress stores revisions of all posts and pages automatically. It's there so that you always can go back to a previous version of a post. As handy as that can be, it also means that the one db table with the most queries gets cluttered. On my blog, I have about 30 posts but 173 rows in the wp_posts table. For any functionality that lists recent posts, related posts and similar, this means that the queries takes longer. Similary, the wp_comments table keeps a copy of all comments that you've marked as spam, so the wp_comments table may also gradually grow to become a performance problem. The other way that you can optimize the Wordpress database is to have mysql do some internal cleanup. Over time the internal structure of the mysql tables also becomes a cluttered. Mysql provides an internal command for this: 'optimze table [table_name]'. Running optimize table can improve query performance a couple of percent with in turn improves the page load performance. Instead of using phpmyadmin to manually delete old post revisions and to run the optimize table command, you should use a plugin to do that, for instance WP Optimize. Installing Wp optimize on my blog, it told me that the current database size was 7.8 Mb and that it could potentially remove 1.3 Mb from it. It also tells me that a few important tables can be optimized, for instance wp_options that is used in every single page request that Wordpress will ever handle.
#3 - Use a cache plugin
Probably the single most effective way to improve the amount of traffic your Wordpress web site can handle is to use a cache plugin. We've tested cache plugins previously on the Load Impact blog, so we feel quite confident about this advice. The plugin that came out on top in our tests a few years ago was W3 Total Cache. Setting up W3 Total Cache requires some attention to details that is well beyond what other Wordpress plugins typically requires. My best advice is to read the installation requirements carefully before enabling the page cache functionality since not all features will work on all hosting environments. Read more about various Wordpress cache plugins here, but be sure to read the follow up.
#4 - Start using a CDN
#5 Optimize images (and css/js)
Looking at the content that needs to be downloaded, regardless if it's from a CDN or from your own server, it makes sense to optimize it. For css and js files, a modern CDN provider like CloudFlare can actually minify it for you. And if you don't go all the way to use an external CDN, the W3 Total Cache plugin can also do it for you. For images you want to keep the downloaded size as low as possible. Yahoo! has an image optimizer called Smush.it that will drastically reduce the file size of an image, while not reducing quality. But rather than dealing with every image individually, you can use a great plugin name WP-Smushit that does this for you as you go along.
Conclusion and next step
There are lots and lots of content online that will help you optimize Wordpress performance and I guess it's no secret that these top 5 tips are not the end of it. In the next post, I will show you how a few of these advises measures up in reality in the LoadImpact test bench.