Nedsferatu.com Blog

The Nedsferatu.com Blog

Nedsferatu.com Blog header image Chicago branding

Wordpress Speed Tweaks and Hacks

May 26th, 2009 · No Comments · Chicago

A few weeks ago I was considering putting good money on the table for a dedicated private server to host my sites. My main reason was to gain the performance advantages of the dedicated resources. I run a handful of sites on a handful of domains with moderate traffic for the most part. Does this sort of load really warrant a private server? Before going that route I wanted to make sure so I started researching performance tweaks for my sites.

I run mostly Wordpress installations with some other apps and some custom apps. The suggestions I found are wordpress specific but some will help any site you want to speed up. The results from applying these have been very good so I hope you consider implementing some or all of them yourself.

Assuming you have all the obvious stuff set up (Akismet for spam and Super Cache for caching) this article also doesn’t have to do with getting people to your site either (SEO, Sitemap, robots.txt, feedburner) or making money once they are there (Adsense, social networking, referals). These are all valuable topics but this article is about showing as many pages to as many visitors as fast as possible.

My favorite hacks so far are:

  • Creating Expire headers using htaccess. This will allow browsers to cache most of the media on your page leading to great improvements in load times. Here’s what you need to add to your .htaccess file:
    Header unset Pragma
    FileETag None
    Header unset ETag
    
    # 1 YEAR
    
    Header set Cache-Control "public"
    Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
    Header unset Last-Modified
    
    # 2 HOURS
    
    Header set Cache-Control "max-age=7200, must-revalidate"
    
    # CACHED FOREVER
    # MOD_REWRITE TO RENAME EVERY CHANGE
    
    Header set Cache-Control "public"
    Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
    Header unset Last-Modified
  • Set up a subdomain to store commonly used images on your site — such as theme images and sidebar images. Browsers will load media in parrallel from subdomains giving you performance increases. Try saving widget images from your sidebar in that subdomain as well rather than making requests to other webservers (feedburner or facebook for example). Be sure to remember to apply the above .htaccess hack to you subdomain as well for additional browser caching.
  • PHP bloat is any php call that a theme makes for what is not, for the most part, dynamic content. For example, look in your theme header.php doc and compare it to the source of your redendered page. My guess is there is a series of php calls (which likely call sql queries as well) for information such as the name of your blog, the location of the .css files, the content type, and others. If you replace this php with the resulting html you will save significant load time on every requested page on your site. Check out the footer and sidebar as well. This is more helpful with a blog that is not changing rapidly and I wouldn’t recommend it for a new install you are still tweaking, but the savings here are significant.

I’m still testing some additional plugins but here is what I’ve liked so far:

  • Javascript to footer will give the appearance that your site is loading faster than it is by loading the content first then parsing the javascript. Easy to implement with instant results
  • Revision Control will help with load on your server while posting. The revisioning feature with wordpress is cool but I’ve found that it leads to more database bloat than it is worth. I turn it off and clear out the stored revisions using a sql query.
  • WP-DBManager is a must have plugin for all wordpress blogs…period. Set it up to run regular backups and optimizations and forget about it. Optimizations will help reverse fragmenting in your database which will improve your performance as well.

These are some excellent resources with many interesting ideas for you to consider:

So for now, I have been able to optimize my sites so significantly that I think a hardware upgrade is pushed off at least for now — sorry Dreamhost maybe next time :-) . As a side note, these tips are essential for preparing for a slashdotting or digging. So if you are creating great content out there on the web — and i know you are — you may want to make site optimization a priority especially if you’ve never considered it seriously before.

  • Share/Bookmark

Related Posts:

  • No related posts

Tags: ··

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment