Easy Tips to Speed Up Your Blog (Part 1)

by on April 11, 2011

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.

Code: PHPphpinfo_test.php

<?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.

Code: PHPCompress PHP Files - php.ini

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.

Code: PHPCompress PHP Files - header.php

<?php
ini_set('zlib.output_compression', 'On');
ini_set('zlib.output_compression_level', '9');
?>

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!

Code: PHPCompress Mime Types - .htaccess

<IfModule mod_deflate.c>
# standard mime types
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-eruby
AddOutputFilterByType DEFLATE image/svg+xml
# exceptions for buggy browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
</IfModule>
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.

Also, there's an online tool that I find very useful in conjunction with W3TC. gtMetrix.com will analyze the performance of a web page using both Google Page Speed and Yahoo! YSlow.

Additionally, the report itemizes the results for various categories. You can use these details (click the category links to view details) to get the URLs of each of the JS and CSS files loaded by your site (many plugins load their own support files) … then paste these URLs into the minify sections for external javascripts and style sheets. (Make sure there are no blank spaces if you copy/paste the URLs.)

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.

Share This Article: “Easy Tips to Speed Up Your Blog (Part 1)”

(Also Available: Press CTRL+D to Bookmark this Page)

Comments

Share Your Thoughts  3 Responses to “Easy Tips to Speed Up Your Blog (Part 1)”
  1. 1

    I’ll right away take hold of your rss as I can not
    to find your email subscription link or newsletter service.

    Do you’ve any? Please let me recognise in order that I could subscribe.
    Thanks.

  2. 2

    Ahaa, its pleasant conversation on the topic
    of this paragraph here at this webpage, I have read all
    that, so now me also commenting here.

Trackbacks

Check out what others are saying about this post...
  1. [...] Up Your Blog (Part 2) by Luke America on April 13, 2011 Leave a CommentThis is a continuation of Easy Tips to Speed Up Your Blog (Part 1). In the first article, we discussed using GZIP compression either through the php.ini  file or [...]



Share Your Thoughts

(Some editor features are restricted unless you're logged in.)

(When replying to a specific comment, your browser may require Shift+Enter instead of just Enter.)


(get a gravatar)


Notify me of followup comments via e-mail. You can also subscribe without commenting.