Speeding up the blog

 Posted by (Visited 8577 times)  Misc  Tagged with:
Jan 162012
 

As you may have noticed if you have been visiting the site lately, it’s been both running very slow and also periodically giving lots of database errors (“error establishing a database connection”). So tonight I did a bunch of stuff to try to speed it up; I have no idea if this is enough, but it should be better!

Here’s the list:

  • Installed WP Minify.
    • I had to specifically exclude audio-player.js so that the little music player would work when I post up a song.
  • Installed WP Smush.it
    • I ran the bulk smusher, but it started erroring on finding a bunch of older images, building a weird compound messed-up URL for them. Makes me wonder how many of those old images are even displaying in the blog…
  • Reconfigured WP Super Cache. In particular:
    • On the Preload tab, had it preload everything.
    • I now use the mod_rewrite setting.
  • I did install WP-Optimize, but I can’t say that it helped very much. I had already gone into phpMyAdmin and optimized all the tables. But this will make it a lot easier to do.
  • I went through the wp_options table and cleared out a pile of orphaned options that included the word “_transient.” In theory these are supposed to get cleaned up, but it didn’t look like they were. There were around 400 of them.
  • I also installed Clean Options, to try to stay on top of this better.
  • I switched Category Icons to to use one query for the icons, instead of one per icon. No idea if this helped, but I suppose it should.
  • Disabled the Gravatars (sorry!)
  • Changed all the little flags from the Global Translator plugin to use an image map. This was a setting in the plugin that I hadn’t noticed, but it was a ton of individual image fetches before.
  • Reduced all the theme’s images by around 90%.
  • Axed the “Get Firefox” button. Everything that reached out to Mozilla was slow.
  • Axed the Google +1 button from the front page. Everything that reaches out to Google is slow. There are still a fair amount of other things that reach out there too.
  • Axed the Facebook Like and Share buttons from the front page. Everything that reaches out to Facebook is also slow.
  • Oh yeah, and that Recent Facebook Activity sidebar too.
  • Switched from vanilla PHP5 to FastCGI. Not seeing any errors, so we’ll see how it goes.
  • Added static caching of images to  my .htaccess file. I used this, which I found on the Net:
 ExpiresActive On
 ExpiresDefault "access plus 15 days"
 ExpiresByType image/gif "access plus 15 days"
 ExpiresByType image/png "access plus 15 days"
 ExpiresByType image/jpg "access plus 15 days"
 ExpiresByType text/css "access plus 15 days"
 ExpiresByType text/html "access plus 15 days"
 ExpiresByType image/swf "access plus 15 days"

I do not expect this to fix everything. In running repeated tests on www.webpagetest.org, the commonest issue at this point is a slow first byte — sometimes up to 10 seconds. I assume that is an issue with my host BlueHost.com. Also, as I write this, I am getting occasional “Error establishing a database connection” messages anyway. So something is still up. But hopefully this is better anyway.

The slow query that seems to lead to the error is, alas, super-generic:

# Mon Jan 16 00:14:53 2012
# Query_time: 1.280560  Lock_time: 0.000000 Rows_sent: 0  Rows_examined: 0
use <db name hidden>;
SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'

This post itself is sort of a test… we’ll see what happens! 🙂

Edit: there is a follow-on post with additional things I ended up doing located here: Blog Hosting Upgrade. Yes, I did upgrade the hosting plan, but there are also some additional optimizations that may help you if you came here looking for assistance.

  3 Responses to “Speeding up the blog”

  1. Continuing to work on it. In order to isolate things, I have turned off most plugins and switched themes to the default one.

  2. thanks for the tips. Pretty much stumbled across this post after looking for ways to speed up my site performance as well. My only challenge is I currently don’t have a way to actually MEASURE how effective these things are as a whole or individually.

  3. You can measure them with webpagetest.org, YSlow, and your MySQL slow queries log.

Sorry, the comment form is closed at this time.