Faster

March 22, 2009 / Speeding up WordPress 2.7 on shared hosting.

I ran around in the yard with my dog today, partly to remind myself how perfectly in shape I’m not, but mainly because she thought it was the best fun ever, and she draws a lot of water around here. Then the temperature dropped, I came inside, and parked in front of my computer. Father of the year? You bet.

This post is actually about things I’ve done (that have worked) to speed up WordPress 2.7 on shared hosting:

  • Output compression: compresses the text transferred (HTML, stylesheets, scripts, etc.) for browsers that indicate they can handle it. For example:
    <ifmodule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/x-httpd-php
    AddOutputFilterByType DEFLATE application/x-httpd-fastphp
    </ifmodule>
  • Expires headers: sends the browser an expiration date for some assets like stylesheets and images so it won’t try to fetch them again until that date is reached. Stylesheets have timestamps appended (e.g. style.css?1237154177) when they change, effectively changing the filename and forcing them to be updated. For example:
    <ifmodule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType text/css "access plus 10 years"
    </ifmodule>
  • WP Cache 2: a plugin that reduces the amount of server-side code execution and database queries required to serve a page, by caching them as static files
  • Simple markup: lean, semantic markup using the HTML5 doctype and as little extraneous cruft as possible
  • Simple styles and behaviours: using only one external CSS and one external JavaScript file, both modest in size

Yahoo!’s YSlow plugin for Firefox and the associated rules helped a lot with the first two things, and Andrew King’s website optimization analyser with general performance testing. More recently I discovered Alex Shiels’ Is My Blog Working—it’s a nice tool though it seems to draw different conclusions as my server’s response time fluctuates.

So that’s that. Citius, altius, fortius, because, as everyone knows: Internet is serious business.

Comments are closed.


Zero to One-Eighty contains writing on design, opinion, stories and technology.