Speed Up WordPress Without Using A Cache Plugin

March 24, 2010

supersonic speed

Today I decided to try something different with this blog. I decided to remove the WP Super Cache plugin and just try server compression instead.  And so far I am very pleased with the results.

I tend to use the caching plugin on any WordPress site I set up.  I don’t always do this because the blog has a lot of traffic and needs it; I do it just so the blog’s responsiveness is as quick as possible.  After today though I’m totally rethinking that strategy.

If you read the post about 5 Quick Tweaks To Improve Your WordPress Blog, you might remember me mentioning using zlib compression to boost your page loading speed.  I tried it in the past, but it didn’t really work for me.  Today I can admit (with a little bit of embarrassment) that it didn’t work back then because I didn’t set it up right.

For zlib compression to work, you have to have the PHP configured correctly on your server.  How you get this to work may vary depending on what type of server or hosting you have, but I will tell you the steps I took to get it to work on my server.

First of all, I’m hosting on Hostgator and I’m using a CentOS server.  If you are using a hosting provider that is using a Linux server and has Cpanel, then the steps I took just may be the ones you would have to take to accomplish this as well.

After logging into my Cpanel, I scrolled down to the “Software/Services” section and clicked on the php.ini settings

At the top of the page of the php.ini QuickConfig page, the zlib compression option is quickly visible.  Mine was set to “Off”, so I just checked the radio button for “On” instead and then saved my settings.

After doing this, I added the following little piece of code to thevery  top of my header.php file, above the doctype html tag in my WordPress theme folder:

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

And that is all that it takes!  I did deactivate the WP-Super-Cache plugin and then deleted the files from my site and I think that this site is running just as fast, if not faster, than it did with just the caching enabled.

I even tested this site here to see what kind of gains I’ve made by enabling zlib compression.  According to them, this blog runs nearly 4 times faster than it did without compression.

So if your blog isn’t getting hammered by Digg or Stumbleupon every day, and you want to keep the amount of plugins you use to a minimum, I would recommend you implement some form of compression over a caching plugin.

Have you noticed how fast this site is? It's not because I have an expensive hosting plan or a fancy server, its because of what Speed Themes did to this site. Even if you're on an inexpensive shared hosting plan like me, the guys over at Speed Themes can boost your blog's speed up!

{ 2 comments… read them below or add one }

Lea March 24, 2010 at 7:15 pm

When I look at cpanel on one of my hosts, I don’t see ‘php.ini Quick Config’, I see an option in ‘Software / Services’ named ‘Optimize Website’. Clicking this lets me choose some options including ‘Compress all content’. There’s no info on further steps to take.
So, theres more than one way to do it in cpanel :)

One way to test effectiveness is to note the date you changed it, wait 2 – 4 weeks and then see how the graph changes in Google Webmaster Tools in Labs > Site Performance and Diagnostics > Crawl Stats

Rob March 24, 2010 at 7:20 pm

I’m thinking that cpanel can be modified to suit a person or host’s desires. Which would explain why the cpanel you see would be different than what I see when I go to one of mine.

I will be monitoring the effectiveness of this compression over the next few weeks and hopefully all goes well with it.

Leave a Comment

Previous post:

Next post: