Many of us put in long hours of diligent effort to keep our blogs up-to-date with fresh, keyword-rich content. After all, it's the useful and timely content that keeps visitors coming back. But, it's easy for those of us with broadband to neglect the speed of our web site for those who don't have similarly fast connections. However, there are several factors that impact the speed of our blogs.
Who doesn't want lightning fast page delivery? In this two part series, we'll start off by discussing two options that will make an immediate (and sometimes dramatic) increase in page load time. Then, we'll follow-up with a list of steps to help ensure you can keep your site blazing fast.
Use PHP Zip Compression on Your Pages/Posts
Some shared servers ($15 or less per month) don't offer zip compression as an option. But, most virtual and dedicated servers offer this functionality by default. If it's available to you, this is a very simple speed increase to implement. We'll discuss two different ways to do so.
To determine if this feature is available on your server, create a file named phpinfo_test.php. And, put the following code in it.
<?php phpinfo(); ?>
Now, open the file in your browser. Scroll down to the zlib header and check the settings. If you have the capability, let's speed up your site right now.
Compressing a web page before serving it to web browser reduces bandwidth usage. With fewer bytes to transmit over Internet, a web page request can be transferred much faster. And, a faster website improves visitor experience and (even) potentially improves search engine ranking. Plus, you may also save money in bandwidth usage for your site(s).
The pages presented by a WordPress blog are composed of many PHP scripts. And, GZip can compress the output of these scripts by simply adding two lines to your php.ini file (usually in /etc/ or /usr/local/lib). Alternatively, you can create a new php.ini file in your root WP folder (the one with wp-config.php and .htaccess), if you prefer.
zlib.output_compression = On zlib.output_compression_level = 9
Here's another method to invoke the same code. You can alternatively put this at the top of your theme's header.php file.
This quick adjustment can compress your PHP files by 80% to 90% … a noticeable difference for your visitors. However, you may need to restart Apache HTTPD server in order to enable this change. You can compare the default vs. compressed sizes at port80software.
Here are three online tools which let you compare the page load time of multiple sites. In fact, you can enter your own site's URL 5 to 10 times to obtain an average load time.
Use mod_deflate Compression on Your Pages/Posts
In addition to compressing PHP files, you can compress CSS and JS files if your server has mod_deflate installed. And, it's installed by default on Apache 2.x+.
You can invoke this extended compression by putting the following code in your .htaccess file. HOWEVER, you should NOT use this technique and the previous PHP technique together. Choose ONLY the one you prefer!
Use a Blog Cache Plugin
As a blogger (and possibly a web developer), you should be aware that all web browsers cache site content so that future visits to a page/site are faster than the first visit. We can perform a similar task on the server itself by caching pages so that they'll be served faster for subsequent visitors.
As your web traffic increases, you may want to implement more extensive speed improvements than the simple zip compression discussed thus far. For WordPress, we have two excellent blog cache plugins to choose from W3 Total Cache and WP Super Cache. The one I'm using on this site (and the one we'll discuss here) is W3 Total Cache.
When someone visits your blog, the back-end has to construct the page and then present it back to the visitor. A cache saves the created page as HTML to show it to the next user. This way, load time is reduced because the server doesn't have to compile the entire page every time. Although your site will be much faster for your visitors, it may actually be a little slower for you.
The default settings for W3 Total Cache are good; but, you may want to optimize them to get the maximum benefit. We'll cover the basics in this article. When you're comfortable with this comprehensive plugin, you might enjoy reading this 44-page manual, W3 Total Cache Configuration Guide. And, here's a comprehensive installation guide to help you get the most W3TC, Setting Up and Optimizing W3 Total Cache.
After installation (follow the plugin instructions) and activation, you'll see a Performance link near the bottom of the dashboard sidebar. Click it to reveal the various W3TC settings pages. On the main page, General Settings, you can toggle the enabled state of the various options (Page Cache, JS/CSS Minification, Database Cache, Object Cache, and Browser Cache). Then on each of the subordinate pages, you can tweak the specific settings.
On this site, page loads are 35% faster by simply enabling the primary W3TC features and pasting the URLs of the various JS/CSS files for minification (stripping spaces, line feeds, etc.). Also, the Page Speed and YSlow ratings each increased by about 10%. How much performance increase do you get?
Part 2 of this article is here.