Top Menu

How to Make WordPress Websites Load Faster

There are a few key techniques I use to get my WordPress websites to load as quickly as possible. I’ll share them here, hopefully this helps somebody out there squeeze some juice of of their websites and their web hosting.

VPS Web Hosting

It helps a lot to have a bit more of a serious hosting option that shared web hosting. Shared web hosting can be fine, and it certainly is cheap. But you will be sharing server resources with many other websites, and you never know what sloppy stuff people will be running on the server alongside your own websites, fighting for resources as people try to load your pages. Plus, with shared web hosting you can’t configure and optimize your server in the same way that you can with VPS or dedicated hosting.

I mention VPS hosting because it is a nice way to get excellent server speeds without the cost of dedicated web hosting. VPS can be affordable, I’m only paying about $40 a month to host around 45 WordPress sites on one VPS hosting account. That’s a pretty good value for me, in my situation.

And once you have a VPS hosting account, you will gain access to server optimization features that you typically won’t get from a shared web host.

With my VPS hosting account from Knownhost, for example, I have WHM/cPanel to manage server configurations and hosting accounts, and on top of that can use SSH to do pretty much anything I need to. I also can build Apache and configure PHP and many other things to my own specifications, which I couldn’t do with shared web hosting.

Opcache

I’ve been using this caching option on my VPS and it works well for my needs. It can be enabled by during the Apache build process. Once it is enabled it works server-wide. From the Opcache intro:

OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.

The Opcache manual is pretty straightforward and covers how to configure it. There are several configuration options, which can be added to php.ini.

My production configuration ended up being something like this (I still tweak values from time to time):

opcache.memory_consumption=384
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=7963
opcache.revalidate_freq=0
opcache.validate_timestamps=0
opcache.fast_shutdown=1
opcache.enable_cli=1
Here’s some tips for fine tuning Opcache that I found useful. And some more Opcache configuration tips. It also helps greatly to use an Opcache status page to monitor server resources while fine tuning.

W3 Total Cache

W3 Total Cache is also a great caching tool for WordPress websites. It has more configuration options than other WordPress caching plugins, which is why I like it.
WPExplorer has a good guide on the basics of W3 Total Cache.
Also make sure to use the CDN option, you can simply set it up using a subdomain on your domain name to help things load a little more quickly. The script minification options are also worth a serious look for most websites.

Optimize Images

This is a pretty big one. Most of the time, images that are being uploaded to a WordPress site aren’t being properly processed for image dimensions and compression before-hand. It’s just time consuming and not a lot of people have access to tools to optimize images before uploading.
There are some plugins that I like to use to help automatically resize and compress images that I upload to my sites, so that I don’t really have to do it manually all the time. Using these plugins helps to keep images loading quickly on my sites.
The plugins:

Both of these work great, give them a shot.

Gzip Compression with Apache

Apache can compress your website easily for you before sending it out to the user, using the Deflate module. If you have this module enabled, you can add some code to .htaccess to compress your entire website easily.

Learn how to use the Deflate module.

Leverage Browser Caching

Apache can also work with the browser cache to keep your website loading quickly, using the Expires module. Like the Deflate module, if you have this enabled you can add code to .htaccess to utilize it.

Learn how to use the Expires module.

MySQL Tuner

It’s a good idea to optimize the MySQL configuration for your particular server setup as well. Do do so, you can use MySQL Tuner and make the suggested changes to the MySQL configuration.

Here’s a quick guide on MySQL Tuner usage.

Conclusion

As you can see, these are a mix of WordPress specific and server-related optimizations. If you can manage to pull off most of these, you will likely achieve excellent performance with your WordPress website. Even just implementing a couple of these optimizations can help.

, , , , , ,

No comments yet.

Leave a Reply