Monthly Archives: April 2007

If your WordPress 2.1 is slow…

I just debugged a strange issue with this WordPress 2.1 blog. It’s running 2.1.2 to be exact, but I think the problem manifests itself with all 2.1.x versions. My site was running really slow – 40-50 seconds per page load. I had just moved it to this new host which is also running a few Rails apps. The Rails apps were running *fast*, so it wasn’t the box.

I checked top and it showed the box was fine. I bounced Apache and MySQL. Still slow. I tried static pages – those were fine. I tried a phpinfo page – that was fine.

I googled and googled and finally found this WordPress thread: [resolved] Update a post and blam.. every pageload is 20 seconds. The solution? I had to add www.luisdelarosa.com to the /etc/hosts file. I guess WP 2.1 has some sort of reverse DNS code in it.

So – if your WordPress 2.1 site is slow, add your blog’s hostname to the /etc/hosts file. You could also backtrack to WordPress 2.0.1. I’ll have to look into moving over to Mephisto sometime.

Tip: Monitor your website and your Rails apps

You probably want to make sure your websites are up, especially your personal and corporate site. Of course you want all your Rails apps to be up all the time as well. It is a 24-7 world we live in after all. Also it will help you monitor your hosting company and let you know if you’re on a bad server or if you should switch companies completely.

So how do you do that? I recommend two options which I personally use. I’m sure there’s plenty of others, so please leave a comment if you’ve had a good or bad experience with website monitoring services.

The first is Montastic. It’s free and built in Ruby on Rails. It will send you an email whenever your site is unreachable and then another email whenever your site is up again. You have to look at both emails to figure out your downtime manually. The site itself is very friendly and you can point it at any URL on your site.

The second is Uptime by OpenACS. It is very similar to Montastic but has a very plain web interface. It also gives you an email on server down and another on server up, but it calculates the downtime for you. You can point it to any URL, but that URL has to return “success”.

The best way to understand continuations

I was reading up about Procs due to an interesting error in some code:
warning: tried to create Proc object without a block

So I picked up my copy (and got a nice little workout in the process) of The Ruby Way, 2nd edition by Hal Fulton. It’s a good book for all Rubists and Railers. It had this nice little gem right before the section on Procs:

The best way to understand continuations is to watch the movie Run, Lola, Run (or the original German Version, Lola Rennt.)

Hal also compares it to a “save game” feature. Probably easier to understand among the video-game-playing-and-computer-programming crowd. Nevertheless, I think its probably still worth it to go watch Run Lola Run to improve your understanding of continuations.