10 Ways to Optimize Your WordPress Site to Make it Faster
February 10, 2016 - Uncategorized
With a recent Microsoft study showing that our attention span has decreased from 12 seconds in 2000 to 8 seconds in 2013, it is becoming increasingly clear that web users are impatient. Further research shows that 40% of people will abandon your website if take takes longer than 3 seconds to load.
While WordPress by default is lightweight and fast, the configuration of the average web user can make things slow and extremely convoluted. If you want a fast WordPress site, pay special attention to the following tips.
1. Regularly Optimize Your Database
WordPress is a CMS that is heavily reliant on database, and this can contribute to a slow experience.
The following aspects make use of a lot of database and can contribute to a slow website:
Post revisions: Post revisions can quickly clog up your database and make your site slower. Each post revision is a new entry in your database, and this quickly adds up. You can either disable post revisions or limit it. If you want limited revisions, you can update your
wp-config.phpfile by adding the code below:
define('AUTOSAVE_INTERVAL', 300); // seconds define('WP_POST_REVISIONS', 5);
The above code instructs WordPress to save a maximum of 5 post revisions, and to only save revisions at 5 minutes intervals. You can edit the code to reflect your post revision needs.
- Pingbacks and trackbacks: Pingbacks and trackbacks can also clog up your database, so you might want to disable them.
- Blog comments: Blog comments are not necessarily bad, until you find out that you have thousands of spam comments that are unnecessarily taking up space in your database. Be sure to regularly delete spam comments to prevent them from taking over memory space.
- Plugins: Some plugins store data and logs in your database; initially, you find them useful until you realize how much space they are consuming. I’ve had a URL shortening plugin that also shows analytics data use as much as 160MB of my database space. Yes, that’s just one plugin! Usually, these plugins are unnecessary and can be removed or substituted.
- Analytics and logs: Generally, be wary of plugins that store analytics and logs data on your site; most of the time, they use a lot of database space and can make your website convoluted and slow.
Better still, you can install the WP-Optimize plugin and use it to regularly clean up your database.
2. Optimize Your Images
The size of your images add up to the time it takes for your site to load; this especially happens when you run an image-heavy site, or when you use images for all of your articles and they have to load on the homepage as well.
There are two ways to go about this:
- Regularly optimize and shrink the sizes of your images; you can do this without compromising quality as I’ll explain later.
- Delay loading of images; this way, images don’t load until readers scroll to where images are. This can also help prevent site loading issues.
By optimizing your images, an image of 2mb can be reduced to 600kb without sacrificing quality; this is done by stripping off information embedded in the image that is not necessary to the user experience. You can optimize images on your WordPress blog by installing the WP Smush plugin or the EWWW Image Optimizer plugin. For a manual option that is not restricted to WordPress, you might want to take a look at Kraken.
3. Enable Caching and Expire Headers
Most WordPress websites could be twice as fast if caching is enabled; caching works by storing a version of your website in your visitor’s browser cache, so that they are automatically served the cached version whenever they visit your website. Usually, unless you configure your cache settings otherwise, your visitor’s browser cache will be refreshed when you update your website, ensuring that they do not lose anything.
By effectively utilizing caching, you can optimize your website speed in the following ways:
- Instead of having to request files directly from your server, your readers’ browsers pull it from their cache, leading to an almost instant experience for them.
- Due to the reduced request on your server, the load on your server reduces thus resulting in your server delivering files to new users much faster.
Caching can be so effective for boosting website speed, and it’s been observed that enabling full caching for your website can improve website speed from 2.4 seconds to 900 milliseconds.
You can enable caching on your website by installing the following plugins:
Once you’ve enabled caching, you can also enable Expires Headers to make your site much faster; by telling your visitors’ browsers when to request certain files from your servers, Expires Headers can save you server resources and deliver a faster website to your users. Here’s a handy tutorial on how to enable Expires Headers.
4. Enable GZIP Compression
What’s your favorite tool for compressing files to ZIP format on your computer? 7-Zip? WinRar? You’ve probably compressed files at least once and noticed the miraculous effect where a file of 200MB suddenly reduced to 40MB? How on earth did that happen? While I’m not too familiar with the technicality of compression, I do know that it is possible to replicate this for your website and ensure a faster website experience.
GZIP compression helps compress your website files to ZIP, and serves everything intact to your visitors; in other words, the experience of visiting your website is the same but your site is much faster since your visitors are being served a compressed version.
In an article for Smashing Magazine, Marcus Taylor featured a case study of a site that went from 68KB to 13KB solely due to GZIP compression; based on GZIP compression alone, that site is essentially five times faster. Here’s a tutorial that shows 3 ways you can enable GZIP compression.
5. Use a CDN
Research has shown that a CDN can increase your website speed by up to 60%.
There are many factors that influence content delivery, but a website that is hosted in India will be accessed much faster from an internet connection in India than from an internet connection in the U.S. There isn’t much you can do about this; people with an internet connection closer to the location of your website will get faster speeds, unless you use a reliable CDN service.
By configuring your WordPress site to use a CDN, you’re enabling distribution of your content across servers all over the world so that visitors can be served the version nearest to them; so someone visiting from Asia will be served a version of your website in Asia, instead of the main version in the U.S.
6. Optimize or Change Your WordPress Theme
Your WordPress theme can also contribute a great deal to your site loading time; if you use a WordPress theme that is bloated, and that relies heavily on external queries, you’ll get a much slower website compared to someone that uses a theme that is built based on compliance standards.
In a case study for Copyblogger, Jerrod Morris revealed how a change in website theme was able to take a site loading time from 630ms to 172ms; this was despite the fact that everything else was equal, except a change in his WordPress theme.
7. Combine Background Images with Image Sprite
Your WordPress theme relies on several background images, in combination with CSS commands, to properly display a clean background; so that beautiful background image you are seeing is probably made up of 12 different background images. On the surface, this looks normal and innocent until you realize that the 12 images represent 12 different requests to your server from your visitor’s browser; what if you can turn these 12 images into 1? You’ll notice a drastic increase in speed.
By combining your background images into image sprites, you can turn your theme’s different background images into 1 image, and then use CSS to get your website to display normally. This will reduce the total number of bytes your visitors’ browsers need to download, delays caused by roundtrips and request overhead. The result is a much faster website for you.
You can combine your images into sprites using SpriteMe.
You’ve probably seen a Facebook downtime bring down websites or make them ridiculously slow? The interesting thing is that this doesn’t just happen when you install Facebook code; it can happen when you install code from any site synchronously – especially analytics or tracking services. If code is installed synchronously on your site, the code has to load first – depending on what section the code is – before other elements on your site load.
9. Enable HTTP Keep-Alive
Whenever a visitor requests a file from your server, each file will be sent individually; the problem with this approach is that it has to open a new connection for each file, eventually leading to a slow website depending on how many people visit your website at once. By enabling HTTP Keep-Alive, you’re telling your visitor’s browser to deliver all files via a single connection; this way, a connection will be left open until all files are sent, thereby reducing the number of connections open on your server and resulting in a faster website.
10. Get a Better Host
If your web host sucks, the tips presented in this article won’t make much of a difference; I regularly analyze and profile web hosts, and in the process I’ve seen web hosts that rate 2 out of 10 when it comes to page load; with these web hosts, nothing you do will make your site fast because their server configuration sucks.
In the Smashing Magazine article, Marcus Taylor included a case study to show how much of an impact a web host can have on a site’s loading time; he compared the site speed of two of his clients; one on a dedicated server and the other on a shared host. The response was stunning; the site on a dedicated server had a response time of 7 milliseconds while the site on the cheap shared hosting server had a response time of 250 milliseconds.
Your web host definitely matters; make sure you do your due research before settling down for a web host.
Visit us at InstantShift.com
Source: Instant Shift