Dingleberry Pi turns 1 years old. Find out what we’ve learnt

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.

 

Ste

Web Developer living in Manchester, working for Studio Skylab (http://www.studioskylab.com). Views and thoughts are my own.

You may also like...

13 Responses

  1. islamike says:

    Happy Birthday DingleBerryPi, and Thanks for sharing the Information.

    I’ve got to say its really Helpful. SO a BIG Thanks.

  2. Anon says:

    You can try some basic load balancing that would kind of go along with your plan to use 4 RasPis. You set up 2 RasPis as web servers, and 2 as MySQL servers. Configure the MySQL servers for master/slave replication so they are in sync. You can then do 1 of two things for load balancing: 1) Set up another Pi with Apache and mod_proxy_balancer configured to point to your other 2 Pis (though this would still put all the request load on 1 Pi), or 2) Set up another Pi as a DNS server with Bind and point 1 hostname entry to the two IPs of your Pi web servers and DNS will perform round robin load balancing.

  3. Maxwell says:

    Love the site… this is just what I’ve been looking for… great job!

  4. there are so uncountable styles of ugg safety-valve shoes.For me the superior high style ugg i loved so much Ugg Bailey button triplet ,Bailey Button Uggs or in other words Ugg Bailey button boots. i must permit i want to buy the delightful and vehement safety-valve uggs repayment for myself.
    kvinner Parajumpers Long Bear http://www.nopjsparajumpers.com/Kvinner-Parajumpers-Long-Bear-PJS-1/

  5. Alwin says:

    You should also consider looking into other web servers, like Cheerokee, Hiawatha, LightHTTP, Nginx. I’m using Hiawatha on my Raspberry at the moment. It has a smaller memory footprint then Apache, some neat features and was easy to setup. But you can/should try all the others too.

    If you are using all of your Raspberries for web hosting, you still need a load balancer to get the sessions/load distributed across your Raspberries.

    Just my 2 cents.

  6. Miguel says:

    I agree with Alwin, you should try both Nginx and monkey web-servers. I´ve tried both on my rasp and looks like monkey is a bit faster on non-wordpress sites.
    Anyway all the reviews claim that the both crush Apache in terms of performance.

  7. dev says:

    To prevent a server outage, have the RPi continuously sending “alive” packets to a microcontroller, able to reboot the Pi using a relay or transistor. If the Pi doesn’t send an “alive” packet, send a command to safely reboot server. Wait five minutes until a signal comes. If no signal comes, force-reboot the Pi by shutting down it’s PSU and turning it back on. Send command to fix RPi hard disk of any corruptions or failures to prevent them from accumulating. Problem solved automatically, every time! No human required!

  8. dev says:

    64-Node RPI Cluster! Run a minecraft server on this and then say: “I have succeeded at making the i7 extreme of RPI foundation 😛

  9. dev says:

    64-Node RPI Cluster! Run a minecraft server on this and then say: “I have succeeded at making the i7 extreme of RPI foundation 😛

  10. Adam Gillrie says:

    Guys these are all great and maybe I’m just missing something really basic here, but now that I’ve followed all the guides. How do I install WordPress?

  11. Mike Olson says:

    I used your install for a Pi2 and for me it will be an alternative to a whole machine being used as a logger for other equipment..thanks for the install instructions and I’m sure more and more apps will be single use

    when I was a boy you only needed 8 bits to control the world

    Thanks

  1. 31st August 2013

    […] Ste W Dingleberry Pi turns 1 years old this week. Throughout that time, we’ve achieved 99.97% uptime, […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.