Raspberry Pi computing cluster: What I'm using it for, and what I've added to it

I have been asked a number of times what the Raspberry Pi cluster might be good for. Here, I will take a look at some answers to that, and also at some of the new hardware bits I used to build it.

Last week I used every Raspberry Pi that I had to build a six-node HexaPi computing cluster.

Since then I have been asked a number of times: what is it good for? So I'm going to take a look at the last bit of the Raspberry Pi Projects - Build an OctaPi, and add a simple example of my own as well.

Photos of the Raspberry Pi through the ages: From the prototype to Pi 3

A walkthrough of every model of the Raspberry Pi to be released dating back to an early prototype in 2006.

Read More

Oh, and I added one more Raspberry Pi server to the cluster, while still respecting my rule of 'no two servers alike', so it is actually now a HeptaPi seven-server cluster. At the end of this post I will add a description of some of the new hardware I acquired and used for this project.

First, what is it good for? I have a simple example from my own experience. I travel quite a lot, I like to take a lot of pictures with a digital SLR camera, and I often take multi-picture panoramas (the Swiss Alps are particularly good subjects for this kind of photography). When I get home, I use the hugin panorama photo stitcher to merge those batches of individual pictures into much larger panorama views.

If I do this panorama processing on a single computer, I have to do the 'scheduling' myself -- that means, I have to keep an eye on it, and when one panorama is finished I have to start the next.

If I get a bit more ambitious, I can set up a batch control program and then queue the groups of pictures to be merged, but they still only get done one after another. If I have more computers available for the task, I then have to do the distribution of pictures and recovery of panoramas myself, and again I have to do the 'scheduling' on each computer myself. Either way, it is a relatively tedious and time-consuming process, and unfortunately I often find myself running out of time (or patience) before all of my pictures have been processed.

With the HeptaPi cluster, I could set up a batch processor, based on any of the Python examples included in the OctaPi cluster project, and then install hugin on each of the cluster servers. Then I could feed groups of pictures to the batch processor, which would distribute them to cluster servers for processing, and would receive the finished panorama image as a return.

My investment in this would be writing the application-specific batch control program, and then identifying the groups of pictures to be processed together. Once that was done, the actual time required until I had all of my lovely panorama pictures would be dramatically reduced -- and I could reduce it even further by simply adding more Raspberry Pi systems to the cluster at any time!

A more general answer to the question of what the Pi Cluster is good for is: any kind of jobs or tasks which can be divided into a number of independent pieces. Note that it is only the tasks themselves which have to be independent -- the results may also be, as in the case of my panorama photographs, but it can also be that the result of each task contributes to some larger result. In that case, the results can be collected on the client system, and then further processed (perhaps even by sending them back out again as a new task) to produce a final output.

Of course this isn't the only use for cluster computers. There are thing like redundancy and fault tolerance, based on the fact that your client is dispatching work to however many servers are available; if a server is taken out for maintenance (or crashes, or whatever), your processing can still continue on the remaining servers in the cluster.

These are all concepts which are typically applied to much larger, more sophisticated cluster systems -- even up to entire cloud services data centers. But my point here is that you can build a simple cluster using very low-cost Raspberry Pi systems, and not only gain very useful knowledge and experience in doing it, but also end up with a useful resource when you are done.

Now, moving on the the hardware that I used for this project. I mentioned that I have added another server to the cluster since I posted the original write-up. That happened because I was browsing the Pi-Shop.ch web site and noticed the Raspberry Pi 2 v1.2.

The overall specs are the same as the original Pi 2, but the new model uses the same CPU as the Pi 3 (but with a lower clock speed). Not a big deal, and probably not even terribly interesting to most people because the Pi 3 is much more popular now anyway. But it was enough to motivate me to get one and add it to the cluster.

The important thing to note about this addition was that I didn't have to do anything to the client (controller) system, or to any of the other servers. I simply prepared the new Pi 2 in exactly the same way that I had prepared the others, and then connected it to the dedicated Pi Cluster wireless network. The next time I started a job on the client, it noticed the new server was available and starting using it along with all the rest.

I also mentioned in the original project that I didn't have enough USB wi-fi adapters to connect all of my Pi systems, and of course adding the new Pi 2 meant that I needed an adapter for that one as well. The Pi-Shop has a couple of new adapters listed, so I figured this was a good chance to try them out.

The most important criteria to keep in mind when buying a USB wi-fi adapter for a Raspberry Pi is that you want to be sure that it works properly out of the box.

I know that might sound silly, but it is the exact opposite of the approach that I take when buying such peripherals for the rest of my Linux laptops and desktops. I am assuming that most people are buying and using Raspberry Pi systems for some specific purpose -- whether it be education, hobbying or for some specific project or device use. Of course, it is possible to get pretty much any USB adapter working with pretty much any Linux distribution, but unless you want to risk having to spend a significant amount of your school/hobby/work time getting drivers set up, just take the easy way out and make sure you buy an adapter which has already been tested and works.

The simplest way to be sure of this is to buy from an authorized Raspberry Pi distributor, and make sure that it says on their web page that the adapter you are buying has been verified to work with the Pi.

wifi150.jpg

The first that I tried was the Miniature WiFi (802.11b/g/n) 150Mbps device. I believe that this is actually the Adafruit Miniature WiFi Module, although the pictures don't look the same -- perhaps it is custom packaging or some such. Anyway, the one that I got looks like the picture shown here, and it did indeed work straight out of the box, as advertised. It cost only CHF 9.90 (around €8.99/£8.00/$10.50).

It is based on a Realtek RTL5370 chip, and it has a blue power/link/status LED.

wifi300.jpg

Since I was in 'try new things out' mode, and I noticed that there was another USB wi-fi adapter with higher throughput offered at the Pi-Shop, I decided to give that one a try as well. It is called simply the 'USB WiFi Adapter for Raspberry Pi (300Mbps)', and looks like the picture at right.

It is considerably more expensive at CHF 23.90 (around €21.70/£19.40/$25) so it is probably worth a second thought before you buy it rather than the one above. Remember, these are Raspberry Pi systems we are talking about, and they are not renowned for the speed and efficiency of their USB connections. So the difference in speed that is pretty much the only advantage of this adapter, might not be significant in your real use of the device.

This device is based on the Realtek 8192SU chip, and it also has a power/link/status LED.

tl-wr802n-04.jpg
Image: TP-Link Technologies

The final new piece of hardware for this project is the one which I think will turn out to be most generally useful - the TP-Link TL WR802N Wireless N Nano Router.

This low-cost device (around CHF 30/€27/£24/$32) is very small and light, and includes a number of predefined and preconfigured modes for common uses. I used it to set up an isolated WLAN with no internet connection (Router Mode), but of course it can provide internet connectivity either via its RJ45 wired network connector (Access Point Mode), or via a wireless WISP connection (Hotspot Mode).

It can also be used to supplement an existing wi-fi network (Range Extender Mode), or as a wi-fi adapter for a device which has only a wired network connection (Client Mode).

The WR802N comes with its own power adapter, but it can also be powered by a Raspberry Pi power adapter (or other MicroUSB smartphone charger), or even by connecting to a USB port on a computer.

My first impressions of this device have been very positive, and I expect that it will be very useful both at home and when I am traveling.

When I decided to build the Pi Cluster, I expected it to be a gee-whiz kind of interesting thing to do, but I also assumed that I would take it apart again before too long. Now that it is up and running, I find that I am thinking of other interesting ways to use it, and to improve it.

Remember, you don't have to have a large number of Raspberry Pi systems to set one up -- two servers and a client are enough to start with. But beware, once you have it running you might find that it is a good excuse to buy more and better bits and pieces to extend it.

Read more

Newsletters

You have been successfully signed up. To sign up for more newsletters or to manage your account, visit the Newsletter Subscription Center.
See All
See All