How to make WordPress fast

I was chatting with a Google engineer last week at SMX discussing the future direction of search. As he was talking, the penny dropped.

Perhaps you’ve heard recently that Google officially announced that site speed will soon impact ranking.

I figured this was a little strange. On the whole, most sites load fairly quickly nowadays and as broadband speeds continue to increase around the world my thoughts were that page load speeds would become less of an issue, not more.

After all, if it were about user experience post search results, Google would have implemented this factor long ago when connection speeds were much slower than they are today.

As a result, I kind of didn’t pay much attention to how fast our sites were loading as I didn’t think it was an issue.

However, after talking with the Google rep, I’ve changed my mind. It’s going to be VERY important.


Google Caffeine

The important missing piece of the puzzle is Google “Caffeine”.

This caffeine project has been a huge deal for Google. It represents a massive investment in infrastructure and a big shift away from how they’ve been doing things. As I discovered, a big part of this project is moving to a “Live” index.

What this means in essence is that as soon as you publish a page, they want it in their index for people to find. When I asked this engineer, “How ‘fast’ do you want it?” he replied, “Our aim is the speed of light.” In other words, their goal is instant availability.

This is where site speed comes in. How will they be able to achieve this if each page on all of the sites around the world takes 15-30 seconds to download? The slower your site, the further they will be away from their live index goal. Crawl times will become an increasingly important factor.

So now I believe that site speed is simply an issue that we can no longer ignore. The bottom line is fast sites will be given preference and I know this is true after speaking to one of their top people.


How to get your site fast

As a result, I’ve done a lot of research on how to get our sites blazing fast. Now of course, you’ll want to have a lean, clean, lightweight site that doesn’t carry with it a huge amount of excess data like big unoptimized images. That’s a no-brainer.

However, as most websites use databases these days, along with big JavaScript and CSS files to execute their evolving interactive AJAX components, it’s becoming more difficult to own a REALLY fast site.

Nonetheless, here are a few cool (sort of advanced things) you can do to make your site fly. I would say that 99% of sites are not doing this stuff at the moment so you have a chance dominate them in this area.

These tips will go from easiest to hardest and are WordPress oriented, however the principles apply to any site building platform.


1) Install a caching plug-in for your content management system.

The caching plug-in will create static versions of the content so the site doesn’t need to talk to the database. It just serves up the content as quickly as it possibly can, without changing the URL’s at all.

We use WordPress for almost all our sites and have found the following caching plug-ins to be the best.

  1. WP Super Cache
  2. W3 Total Cache
  3. Hyper Cache



2) Pull JavaScript libraries from the Google Content Distribution Network (CDN).

Lots of sites (especially if they use plug-ins) use common JavaScript libraries like MooTools and JQuery. These are JavaScript files that contain all the magical code that makes your site do all the Ajax type stuff like popping up light box windows, opening menu’s, sliding photos etc.

Unfortunately, these can add a fair bit of size to a page as the JavaScript file has to be downloaded before the page can load. Once it has done it the first time, it’s normally kept in your browser cache so you don’t notice it later. However, spiders and first time site visitors don’t have this luxury.

So here’s a little known trick. Rather than loading it from your site, load it from Google itself using their own public code libraries. The beauty of this is that if you load it from Google directly, it will be superfast for the Google spiders. Plus, if that visitor has been to another site that’s accessed the same file, the browser will pull it from the cache, rather than try to download it again, making it faster for the end user too.

Here’s how we do that for Prototype, JQuery and Scriptaculous.







You can just remove what you don’t need. If you want to dig in more, check out the documentation here.



3) Serve all your page assets from a Content Delivery Network (CDN)

If you have a reasonably busy site (at least a couple of hundred people a day) you should consider pushing all your big files out to a CDN instead of loading them all from your own server.

Essentially, CDNs are big groups of servers spread out around the world. When you upload a file to a CDN (Content Delivery Network), it won’t live just on one server. It will live on servers around the globe allowing visitors to pull the file requested from a CDN node server that is close to them geographically, not off the original web hosting server.

So for example, we host our site on the Rackspace Cloud in the US. However, all our images, CSS and JavaScript are served via a CDN. So when I’m in Australia and I visit our site, the main page is loaded from the US, however, all the files that take the longest to download are served from a local server in Australia. All automatically using clever DNS.

Now this might sound difficult, but it’s actually VERY easy. Here is the coolest thing. The best CDN in the world is called Akamai. Most people agree on this. It’s what most of the biggest media companies in the world serve their content on. They have the best system, and the most nodes, so they tend to serve content from servers that are geographically closer to users all around the world.

However, it used to be that this was VERY expensive and really not within the realms of small companies like ours (and perhaps yours).

This has recently changed.

I found a cloud hosting provider called VPS.net that has started offering the Akamai service for amazingly low prices.

Right now, this information isn’t advertised publicly, so you’ll need to contact them direct for their prices. However, I’ve discovered that it ends up costing no more than most other CDN providers. You’ll need to buy at least 1000 gig in bulk, however, it’s pay as you go, and not a monthly fee.

Here’s a good tutorial on how you set it up.

Now it might feel a bit confusing at first, however, it’s surprisingly easy. It basically works like this:

  • You specify the original server that hosts all the content in a config file in Akamai.
  • You create a special subdomain like http://akamai.superlever.com
  • You then point (via a CNAME) that subdomain to an edge subdomain you set up with Akamai. For example http://superlever.edgeserve.net.
  • You then point all the references to http://akamai.superlever.com/images/image.jpg instead of http://www.superlever.com/images/image.jpg
  • You can do this using wordpress plugins like CDN Re-writes, W3 Cache etc.

In doing this, here’s what effectively what happens:

Akamai receives (via the CNAME) the request of:

http://akamai.superlever.com/images/image.jpg

Which then maps over the top of:

http://www.superlever.com/images/image.jpg

The first time the file is requested, it is pulled onto the Akamai network and from there it is distributed across the nodes.

In future (for as long as you cache it), the Akamai network pulls the files from local servers around the world, instead of your original host.

The magic behind this is that the end user, regardless of location feels as if your site is hosted on a server within his or her city, not somewhere on the other side of the planet.

Pretty amazing stuff huh?

The Akamai documentation is a bit intense and at times, can seem confusing. Best to stay within the confines of this guide and you’ll find it a whole lot easier:

Plus, feel free to ask questions or to share your ideas below.

By the way, I know we still have other things we can do to make this blog faster. We’re not preaching here!

33 Comments on "How to make WordPress fast"

  1. Wow, excellent guide. We are using Amazon AWS and their cloudfront service for one of our sites, however they don’t distribute https pages through coudfront which is a shame – do VPS.net?

    • Yeah, SSL is pretty expensive. From my quick research, it seems like most providers require that you have your own SSL cert with them. I believe Akamai does do it, but it costs a fair bit more. Possibly the VPS.net’s other highwinds offering might have a cheaper option on that.

  2. I’ve also been hearing a lot about how site speed is becoming an important factor but I have mostly just ignored it as you did. But this post has opened my eyes to it so I am going to implement a caching plugin right now and look into the other things you mentioned. Thanks!

  3. Andy says:

    Most sites will continue to be kind of slow to load I think with large header graphic images, but a web crawler is only looking at the source code of the page.

    So we need to get the source code delivered fast by avoiding generating this code from the database at the time of arrival of the search engine spider.

    So caching of blogs will be the easiest solution for most of us.

    But auto-blogs will suffer greatly if they have to fetch content and construct new posts when they are triggered by the arrival of a bot.

    WordPress has a scheduled task feature that is triggered by hits on the blog, it’s not triggered by a server timer such as a CRON job.

    So if a SE bot keeps looking for new content, it might think that the low traffic blog is slow to load.

    But, I guess that the ping feature of blogs should take care of this where new posts are signaled to the blogosphere?

  4. auto content says:

    thanks for best info about cache wordpress..

  5. Efren says:

    Hello undoubtedly the upload speed will be the first factor to consider if we want to be shown within the first natural search positions, this obviously not forgetting the SEO optimization, an essential for any web site, thank you for this wonderful post, greetings.

  6. gerard says:

    great article will do cache now and look at the other points made just stating out all advice is helpfull

  7. Gavin says:

    For anyone running a wordpress site, looks like the caching is a no brainer, especially with the older blog posts remaining static.

    I think the google idea for java script files is awesome
    Well done and thank you

  8. james says:

    Great post! My question is: for the JavaScript where do I put that code? I’m not an expert. I would like some detail explanations.
    thanks

  9. I like the caching plugin idea and the Javascript idea. Nice to know about the CDN, its new information for me. But I think I won’t need it considering the load of content and visitors on my site. Is it okay to install the script just like any other script on the site?

    • For sure. It’s just like any other plug-in. Some work well, others don’t when they interfere with another one. The Caching ones tend to have a few issues, but you can just switch them off and it’s all back to normal.

  10. Ian Anderson says:

    And of course don’t forget Googles webmaster Tools!!

    Google will tell you exactly what you need to do to your site to make it faster. Combining CSS files, etc.

    Easy to forget the tools sitting on your doorstep!
    Websites….will we ever ‘master’ them……..

    • Yeah exactly. That’s were we grabbed that image at the top of the post from. If you go under the “labs” menu item (I think that’s what it is labeled) you’ll see the a tool that measures site speed. I’ve found it’s not quite accurate (it measures it slower than I find it is), but I guess it’s a relative indicator.

  11. hopskole says:

    Thanks for share…
    This is very useful for everyone, I will try it on my site

  12. odie says:

    niche article to push wp running

  13. ibenk says:

    Maybe I was one person who felt the effects of changes in search engine algorithms. a fairly dramatic decline in the visitor’s. after I check my web presence on search engines, it turns out I found my website was no longer in “page 1″

  14. Huteri says:

    Oh.. why is..
    i think , it’s very good.. Thx for the article.. i’m very like it

  15. simon g says:

    Thanks for share…

    movingtoquotes.com

  16. Ms. Liz says:

    Thanks for these tips and ideas. My blog has been getting progressively slow and I’ve had visitors say so :-( I wasn’t sure what I could do about so your information has helped. Something as simple as a plugin is easiest to start with so thanks for that.

  17. Meria says:

    okay.. it’s awesome for me.. thanks a lot dude…

  18. I’ve never tried caching before, i was afraid with not-up-to-date pages are being displayed. However i’ll give it a try now.

  19. Carla says:

    If your content is fairly static, won’t the pages be pretty much cached anyway?

    • Yes, if it’s a static HTML page for sure. However, if it’s using a CMS like WordPress, it’s dynamically created on the fly. So caching helps with this.

  20. Gat says:

    I have question though:
    If such is the case, aren’t sites which are hosted in different countries going to lose out on their PageRank? Because there are some countries around the world where their Web hosting focuses mostly on the local regions. Plus, there are some where they have good traffic, but their web hosting providers are pretty crappy, thus leading to an increase in load times.

    • Yeah this is true. Which is why the CDN will help that out for sure. If you’re doing most of the heavy lifting via the CDN, and caching your DB calls, it should be fast enough to not worry too much. Of course, getting in and optimizing your site images and files is important too.

  21. David Kamau says:

    I installed one of the plugins recommended in point# 1 above. Yes, my blog pages now do load much faster than previously.

  22. magnetic says:

    nice info.. my wordpress blog is so slow.. i dont know about cache.. maybe i will try this cache pludgin…
    thank for great tips for wordpress

  23. rionur says:

    hemm.. okay.. nice info ,
    i will take your plugin

  24. Hi,

    http://www.speedppc.com is een goede website, daarom ik heb een vraag aan u.

    Ik zelf kan ook beslissen, waar ik wil de volgende grote vakantie te nemen.

    Over de hele wereld, het is prachtig…

    Het zou ideaal zijn: reizen en de hele wereld !

    Mijn vraag aan het forum is: in welk land ze willen om te reizen? Naar Italië, Spanje, Frankrijk,…?

    veel groeten!
    embecubackile
    Mijn beste vakantie: Duitsland

  25. About Web says:

    I tried several caching plugins, but this is useless for me as my hosting provider settings doesn’t store cached files on client-side.

Trackbacks for this post

  1. Tweets that mention How to make Wordpress fast | SuperLever -- Topsy.com

Got something to say? Go for it!