Home » How To

How To Speed Up A Sluggish WordPress Blog

Generally, your WordPress blog will go along fine without a problem – but once in a while you’ll find it very sluggish. Why? And what can you do about it?

WordPress can be very resource intensive (a fancy way of saying it’s VERY needy!) For example, WordPress uses mySQL for the database – and this can result in a dozen or more database accesses for each page. And while mySQL is very well written, it still adds up.

As well, some plugins can be poorly written or really put mySQL through a workout. For example, I once did troubleshooting on a site where they were running a stats plugin for WordPress – so EVERY TIME a page was viewed, it logged into the database again to read AND update information.

The slowdown was because while reads are fast, writes to the database (any database) are much slower – and that much data was choking an already-slow system.

And the client was wondering what his site was hanging!

Where you reside can also cause issues: shared hosting can result in a blog being on a web server with dozens (even hundreds) of other blogs – all competing for attention from the sever, the PHP interpreter, and mySQL. The result is your neighbors can be slowing you down!

So what can you do?

  • Time it. On the default WordPress theme you can view the source of any page, and see how long it took to display (use your browser’s View Source option, and then look for the time near the end). It will also display how many database accesses you had. Typically, 1/10 of a second is reasonable for WordPress; 1 second (or more) is a problem; it means that you can’t handle more than a single visitor each second….
  • Disable plugins. First, time with all plugins running, then turn them off one by one. If you get a big jump in speed, then that plugin is causing the problem. Decide if you still want to use it. For example, instead of a WordPress stats plugin, just use the built-in logs that come with all hosting accounts – not as easy perhaps, but you’ll speed up your site.
  • Cache. wp-cache is a plugin that stores page requests, and gives back the snapshot instead of calling the database again and again. For a site that has a number of requests every second, this can provide a huge boon in speed.
  • Consider other hosting. Shared hosting is, well, shared. Although the time and effort of managing a server can add up, you control the system, which makes it easier to figure out what the problem is. Or check into virtual hosting, which is a bit better than shared (although you still share a computer). At the very least, consider having several hosting accounts with different hosts, and see which ones are constantly a problem.

    Plans I CAN recommend: Lunarpages (where this blog is hosted); Godaddy (great deal on virtual servers); and Hostgator (great shared and reseller plans)

There are many more tricks, but this will give you a starting point. Once you get the hang of timing, you just need to figure out where the problems are, and what you wish to do to fix it. Target the biggest problems first, and you’ll likely see big changes with less effort.

Digg this! Add to del.icio.us! Stumble this! Add to Techorati! Share on Facebook! Seed Newsvine! Reddit! Add to Yahoo!

4 Comments »

  • Karel Segers said:

    My WordPress installation was sucking so many resources that GoDaddy shut it down. Without warning.

    Two lessons:

    1) Monitor speed and taken the necessary measures.
    2) Avoid GoDaddy.

    Karel

  • Administrator said:

    mysql Database access can use a LOT of resources – especially if you have a plugin updating on every page view (such as a stats plugin). A cache program may help – as well as turning off plugins that write to the database for each page view.

  • Michael said:

    I have a site with 6,290 pages. I can get the site to load rather quickly however the wp-admin does not load well when I click on the edit and/or add new page button. What would you recommend that would provide a more stable environment for this many pages?

  • David Pankhurst (author) said:

    If the pages load well (and your web host doesn’t complain about loading of the server) then the only problem is a sluggish admin (and just for you). WP Admin has been sped up in 2.8, so upgrading may solve that problem for you.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.