Dingleberry Pi turns 1 years old this week. Throughout that time, we’ve achieved 99.97% uptime, and the growth of visits has been phenomenal. It’s been a year of learning, testing and tweaking, overcoming some of the shortfalls that the Raspberry Pi has.

Something I’m experiencing quite a lot is MySQL service outages, and given the site attracts 16,000 visits a month, this is understandable. The 512mb model B is undoubtably more capable of handling more traffic than its earlier 256mb sibling, but how do you overcome service outage, and how do you get alerted when it happens?Birthday

Steps I’ve taken to keep the site online

There’s no getting round that the more visits you receive, the harder your Raspberry Pi server has to work, the more likely it is to go wrong from time to time. I’ve set a cron to restart mysql twice a day. This clears the service cache and has made a massive difference.

Uninstall any unnecessary services, and check your configuration in my.cnf. Tweaking your memory buffer settings can help. I will cover this in a tutorial at a later date.

Use a caching plugin if you’re running a WordPress site. WordPress gets more and more database hungry with every passing update. Using a caching plugin like Quick Cache massively reduces server load, and load times of the pages on your site.

Keep it backed up! I have a nightly backup to Amazon S3, and touching wood, never had to restore one yet, but the piece of mind helps me sleep at night!

Steps I’m going to take

The next step, without a doubt is to put the MySQL service on a separate Raspberry Pi. The Raspberry Pi that hosts the entire site at the moment will only manage Apache2, PHP and postfix. The second will run as a dedicated MySQL server. Sharing the load across two devices reduces the likelihood of service outage.

Once I’ve acquired the necessary skills, my intention is to create a cluster of 4 Raspberry Pi’s, which will act as a single server. Yet again, a tutorial will follow in due course!

Staying aware of outages

It’s important to be kept in the loop of outages on any web server. Using services like Pingdom, you can be alerted of system down time.

Aside from the usual ping tests, I’ve created a transactional test that alerts me when the MySQL service is down. See the screenshot below for the settings to use for your own test.

Pingdom MySQL check

What I’ve learnt in the project so far

This year-long project has been a real eye opener for me, and there’s so much that I’ve learnt along the way. This is what I’ve learnt in the past year:

  • A Raspberry Pi can run Apache2, PHP and MySQL reasonably well
  • You can reliably run a WordPress site from a Raspberry Pi Web Server
  • The Raspberry Pi can perform better by overclocking it and running the OS from a high quality USB Flash drive
  • They stay relatively cool, although heatsinks are recommended
  • They can handle upwards of 16,000 visits a month with only a couple of service failures. Afterall, we are really testing the capabilities of these £30 web servers!

I don’t know where I’m taking the project next, but it will carry on. I’m a backer of the Ghost blogging platform, so a natural progression would be to try running this on a Raspberry Pi. As mentioned before, having two Raspberry Pi’s to run the site, but this is only to serve the growing traffic to the site. What are your thoughts, what should I try next and where should the project go? Comment below.