Raspberry Pi hosts itself

July 20th, 2012 by

We’re now running a mirror for the Raspberry Pi download server and the Raspbian apt repository on a Raspberry Pi.

The first problem was obtaining a Raspberry Pi as buying one was tricky: firstly the online shops were down then the queue for a Pi was rather long. As any banker can tell you occasionally crime does pay so I abducted Mooncake, a cat which owns Liz and Eben. I then ransomed the feline back in exchange for a Raspberry Pi.

The hardware setup starts with a power supply with an IEC14 connector connected to the masterswitch for remote power cycling. This PSU connects to a powered USB hub, with a USB lead connecting to the power connector on the Raspberry Pi. The Pi is then connected back to the hub on the data cable with a 1TB USB external hard disk attached to that. There’s a 100Mbit ethernet cable which connects up to the core Mythic Beasts network and out to the Internet. Technically the switch port on the other end is 1Gbit but the Raspberry Pi isn’t fast enough to use that.

The yellow fibre in the background is a very large Internet exchange with over a terabit of bandwidth, the Pi isn’t connected directly (that’d be too stupid even for us) and the packets travel from the Pi to the exchange a couple of feet away via another building. However with LONAP and LINX within 2ms and AMSIX a mere 8ms away it’s still rather well connected.

The software setup on the Pi is fairly straightforward. We started with the Debian squeeze image, ssh / apache enabled, munin enabled (graphs here). We’ve changed the password (obviously), the ssh keys (shipping the same ssh key on every OS image isn’t optimal), and moved /var/www and /var/log to the USB disk so as not to fill the SSD card. rpi-update was needed to make the USB/network setup stable under load as the initial image kept crashing. We also set the RAM split to 224MB for Linux as we really aren’t using the GPU.

It’s up and running both IPv4 (93.93.128.128) and IPv6 (2a00:1098:0:80:1000:13:0:3), as the core Raspbian server is also running IPv6 and the main Raspberry Pi server is also IPv6 at present this machine has seen more than 50% of its traffic over IPv6. I suspect this will change as people download images from it though.

At present the Raspberry Pi is devoting nearly half its CPU to drawing munin graphs so I need to benchmark the new Raspbian distribution to see if the hard float debian build improves the anti-aliasing, as presently all the calculations are done without using the FPU on the arm core in the Pi. Benchmarking suggests that we can deliver 35-50Mbps of file downloads reasonably comfortably at present.

Is this sensible? We’ve had a few customers ask us if the Raspberry Pi would be a sensible device for hosting on as it’s very cheap and very low power. Unfortunately it’s also very slow for this kind of application and the supporting hardware is very bulky. The i7 quad core mac mini occupies less space than the Pi + hub + disk + PSU, uses about fives times as much electricity, costs about five times as much once you include the supporting hardware but is hundreds of times faster. So revolutionising the hosting industry isn’t going to happen with the Raspberry Pi, at least not until they build a PoE one with gigabit ethernet and more RAM.

It’s not currently sensible to do this with shelves full of Raspberry Pis because the performance per Watt isn’t good enough. But we’re working on it.

Raffles

Thanks go to Liam Fraser and Mike Thompson for adding us to the official mirror lists for the Pi and Raspbian. Additional thanks go to Eben and Liz for paying the ransom fee of one Raspberry Pi in exchange for the safe return of Mooncake who looks a lot like Raffles.

Mythic Beasts support Raspberry Pi at Nominet Internet Awards

July 6th, 2012 by

This evening I joined Eben & Liz Upton at the Nominet Internet Awards in my role as a contributor to the Raspberry Pi project. We were moderately surprised when the project won the Outstanding Contribution award. We’d like to offer our congratulations to everyone nominated for an award and to thank Nominet for an excellent evening.

People with excellent eyesight may be able to spot me in this photo taken by Dr Black.

Improvements to DNS API

July 3rd, 2012 by

All Mythic Beasts domain registrations include access to our DNS service, which includes a number of powerful features.  One of these is an API that allows you to programmatically make changes to the DNS records for your domain.  This has a number of uses including:

  • Automating DNS-based failover
  • Scripting the redirection of requests to another server to display a holding message during maintenance periods
  • Implementing “dynamic DNS” so that you can have a static hostname for a dynamically allocated IP address

The DNS API provides a simple, HTTP-based API, that is designed to be trivial to script.  We’ve recently made some improvements to the API.  The first is that where multiple commands are included in a single request, they are treated as an atomic transaction, meaning that they either all succeed or all fail, and there is no risk of the changes being made live with only some of the commands completed.  This means that you can change a DNS record by including a DELETE and an ADD command in a single request.

The other change is that the API now makes use of HTTP error codes to reflect the results of the transaction.  If you get a 200 response, all of the commands succeeded.  If you get anything else, then none of the commands will take effect.

You can find full details of the API, including some sample Perl code on our support pages. It’s also pretty easy to script it on the command line. Here’s an example of how to change a CNAME record using cURL:

curl --data 'domain=example.com&password=s3cr3t&command=DELETE www 86400 CNAME live.example.com.&command=DELETE www 86400 CNAME backup.example.com.'   https://secure.mythic-beasts.com/control/fcgi/customer/primarydnsapi

Leap Seconds

July 2nd, 2012 by

There’s a well publicised bug in the linux kernel which makes it unhappy with leap seconds and usually Java and Mysql. If you’ve a linux box running at high CPU for no explicable reason after the leap second at the weekend you were probably affected.

The fix is,

/etc/init.d/ntp stop
date; date `date +"%m%d%H%M%C%y.%S"`; date
/etc/init.d/ntp start

This is what it did to the power monitoring in one of our racks with a large number of affected machines.

There is a reason we allocate the whole power allocation for a server and not just the typical idle usage.