Two Lessons in Running Web Servers

This is an pretty old post from my blog, which has been preserved in case its content is of any interest. You might want to go back to the homepage to see some more recent stuff.

First of all, a big shout out to les hommes et femmes at http://korben.info/, who today have taught me an important lesson.

At about 9:30 today, they posted a list of 50 things to do with your Raspberry Pi, which included the Raspberry Tank. At about 9:40, my web server melted. This is the disk I/O graph:

Sparrowhawk Disk I/O Graph

Somewhere around five Apache instances per second were being spawned, all of which seemed to be waiting for each others’ I/O operations, and combined together managed to slow everything else to a crawl. It took twenty minutes to successfully ssh into the server and stop Apache. In that whole time, I think about five visitors might have actually have seen a properly-formed web page.

From that point, it was a dainty command-line dance to get enough of WordPress up and running that I could set up a page caching plugin, but not so much of it that visitors could actually request pages themselves.

At around 1pm, I finally managed to get back up and running again – and the floodgates opened.

Sparrowhawk IPv4 I/O Graph

So, today I learned two important lessons about running your own web server:

  1. If you are going to do something cool with a Raspberry Pi and post about it on your blog, CACHE THE PAGES.

  2. It’s a great idea for your web server to send out e-mail alerts when it is dying. It’s a less great idea to host your e-mail system on the same machine.

Thanks, crazy French blog.

Add a Comment