HomePostsJan 12, 2015

A Few Thoughts on WordPress Performance

“WordPress is a server hog”

“WordPress keeps crashing”

“You can’t run a fast WordPress site”

I’ve heard these kinds of statements over and over for years. If you know a little bit about web development but not enough about your options here, then the conclusion, in a way, makes sense. You’re loading templates and plugins and all the core code, all of which hooks into a database, all of which can be a bottleneck for performance. It just makes sense.

But, in practice, there are very simple things you can do to make a WordPress site run almost as fast as a static files site and you don’t need $1,000/month in hardware. The key is attacking all the low-hanging fruit through plugins, lack of plugins, and good configuration.

I’ve been asked a few times how to speed up a WordPress site and, despite the numerous Google results for the topic, I wanted to give my $0.02. Here are a few thoughts on the topic in no specific order, though amazing that they all start with the same letter, no?

hard-drive-install

Configuration

Good performance comes from a good basic setup. I’m not going to cover Apache/nginx and MySQL configuration here because most people don’t have access to those and things can get worse if the changes aren’t made properly.

Long story short: some hosts allow you to mess with these settings, some don’t. You’ll see a lot of different techniques for doing this but they all come down to affecting PHP settings for a particular site in some way. the WP settings you listed are covered in-depth here. A few things to try:

You can do all of that together but it’s all going to do the same thing so just try each one out in sequence (it’s in order of my preference above) and see if it works.

How can you tell if any of these works? First, the site should obviously run faster, that’s a good indication. But to make sure, you have to check what PHP is using when it’s running:

When you load that phpinfo file, you’ll see something like this. Search the page for “memory_limit” and you should see a line like this. Left value is the “local” modified value, the one on the right is the master value for your server environment. You’ll also see a number of other values there that can be helpful in troubleshooting, including loaded libraries and other things.

Code

This is a bit fuzzy compared to the others. The long and the short of it is “use good code,” which is qualifiable but difficult to achieve, especially if you’re a site owner and not a WordPress developer.

For site owners:

For developers:

A quick note on troubleshooting performance issues stemming from plugins: your best bet, if you can, is to deactivate all plugins and then activate them one-by-one until you find the issue. If there isn’t just a single plugin causing the problem, then you have too much going on. If you absolutely need BuddyPress and WooCommerce and GravityForms and 20 more plugins while running an off-the-shelf theme, you’ll need either a custom theme that can wire this all up properly or you need a faster server. There is a limit to what your web host can do.

Caching

Caching is the easiest solution for performance problems and should be a part of every WordPress site out there. Caching works to reduce the load on your database by serving data or HTML that was created on a previous visit. As such, caching only really works for things that have happened before.

For sites without logged-in users (besides admins and editors), the simplest thing to do is to install a page caching plugin like WP Super Cache. You can simply install and turn this on and your site will be much faster and much more resilient to traffic-triggered crashes (assuming the plugin works on your server). Try clicking around the site in a browser where you’re not logged into the site and make sure everything is loading as it should. A few advanced settings for WP Super Cache I like to use:

The next level is to install an object caching plugin like the APC Object Caching plugin if APC is available. This provides query caching, which can help out DB-query-heavy sites quite a bit. Ask your host if APC is available and follow the instructions on the plugin carefully for installation.

So that’s my say on the topic. If you have any additions, questions, or corrections, let me know in the comments below, happy to help as best as I can!

< Take Action >

Suggest changes on GitHub ›

Comment via:

Email › GitHub ›

Subscribe via:
RSS › Twitter › GitHub ›

< Read More >

Tags
Hardware WordPress
Newer
Older

Jan 08, 2015

Rank It WP: A Community Curation Theme for WordPress

My latest shipment comes in the form of a premium theme called Rank It WP. The idea, explained in-depth after the jump, is a Product Hunt-type site in WordPress.