cancel
Showing results for 
Search instead for 
Did you mean: 

My Raspberry Pi Cluster - Was is it worth it?

Anonymous
Not applicable

My Raspberry Pi Cluster - Was is it worth it?

Well I've spent the last good few hours building a 5 node RPi cluster using Pi 3s running Arch Linux. I have just completed a test to calculate primes and this is the result:

[Mook@node0 ~]$ mpirun -n 4 ./mpi_prime.o
Using 4 tasks to scan 5000000 numbers
Done. Largest prime is 4999999 Total primes 348513
Elapsed Time : 5.71 seconds
[Mook@node0 ~]$ mpirun -n 20 --hostfile host ./mpi_prime.o
Using 20 tasks to scan 5000000 numbers
Done. Largest prime is 4999999 Total primes 348513
Elapsed Time : 1.44 seconds

I'm please with these results so for me it was worth it.

22 REPLIES 22
7up
Community Veteran
Posts: 15,824
Thanks: 1,579
Fixes: 17
Registered: ‎01-08-2007

Re: My Raspberry Pi Cluster - Was is it worth it?

I thought clustering the zero's was the in thing now?

Either way, what does this clustering thing allow you to do in reality? - I thought it was the same sort of idea as multiple cores - but seems a bit pointless when you have to have seperate OS's running and all communicating with each other. Clever though I'll admit.. 

But as I understand it, you cannot run the same instance of a program across all of the nodes? - but a (for example) windows program can launch multiple threads and they'll all run across whatever cores they are assigned to.. but still remain part of that program.

So what is the real advantage of clustering?

I need a new signature... i'm bored of the old one!
Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

Multi-threading applications tend to do different tasks in each thread, sharing the processing load by assigning predetermined threads to the available cores, and requires a controlling program to sequence tasks using appropriate semaphores, to achieve a particular result.

 

Cluster applications tend to do the same task on each node, but each using different data to work with.

For example each core might solve separate Bitcoin mining calculations independently.

Another example might be sharing rendering of a graphics display, where each core does a different screen area.

 

Another difference is that multi-threading only scales well to a handful of cores,  whereas clustering nodes pretty much scales linearly and therefore can be used to solve hugely parallel problems - only limited by how many nodes you can afford.

Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

@Anonymous has explained it rather well but obviously not everyone has a need for their own cluster. I did consider a cluster of Zeros but they simply didn’t cut it due to their limited specification.

I built this one to help me process and sanitise my raw input and output data and to collect data from the Internet. For example we use a python script launched from a cron tab that makes over 2000 web requests everytime it is launched and the results of these requests are stored in a PostgreSQL db. This script takes a finite amount of time to complete and albeit very rarely can take longer than the time it takes between market updates and it’s next launch, so we end up with inconsistent data. So to get around this issue I’m going to re-write the script to make use of the cluster. This will result in each node* getting the data to make ±330 requests that will themselves get split across the 4 cores of the Pi with each core making ±80 requests.

Using this approach I expect to get a substantial increase in turnaround, but this of course remains to be seen.

* I bought another Pi that arrives today along with a stacking case so the cluster now has 6 nodes of 4 cores. I’ll post a picture later once I have everything in the case.

7up
Community Veteran
Posts: 15,824
Thanks: 1,579
Fixes: 17
Registered: ‎01-08-2007

Re: My Raspberry Pi Cluster - Was is it worth it?


@Anonymous wrote:

 

I’ll post a picture later once I have everything in the case.


Hurry up!!!! lol

I need a new signature... i'm bored of the old one!
Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

Sorry!

Excuse the mess!

Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

Thumbs_Up  Well done on an interesting project  Cool

 

I just wish that I had the spare time to dedicate to experimental projects like this  Cry

7up
Community Veteran
Posts: 15,824
Thanks: 1,579
Fixes: 17
Registered: ‎01-08-2007

Re: My Raspberry Pi Cluster - Was is it worth it?


@Anonymous wrote:

Sorry!

Excuse the mess!



Very nice!

 

To think... you've probably got far more processing power there than my full blown desktop (2x quad core 3GHz, 16GB DDR2). Amazing what these little devices can do these days..

I need a new signature... i'm bored of the old one!
Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

Thanks for the kind comments, very much appreciated. As I said in reply no 4 it was constructed to do data processing so I'll be writing C++ code to validate data pulled into temp tables in PostgreSQL and if this works as well as I hope it will I intend to double it's size up to 48 cores. Cheesy

If anyone is remotely interested in a shopping list and a how to I'll gladly document it and provide any useful shell scripts along with it.

Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

You might find this new build series interesting - Water Cooled Raspberry Pi 3 Cluster (Supercomputer)  Shocked

Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

That's an interesting video, it will be good to see the actual build. But having said that I suspect he is building it for the sake of building it. Because if he is water cooling it so he can overclock then IMO he's using the wrong boards in the first place.

Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

Speaking of clusters, I did some experiments on mine and I've concluded that its really not up to the job I had it pencilled in for so I've ditched the data processing use and ear marked them for another task. What is that other task you might ask, well it's going to be a load balancing Apache web server cluster. But as the site in question makes extensive use of Web Sockets it will be interesting to see how it fairs against the existing stand alone site server.

Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

I have built everything on my home network (except network switches and powerline adaptors), and it is amazing the difference in actual real-world performance of apparently similar CPUs, depending on what task you have given them to work with.

The really telling benchmark is often the single-thread capability, as multi-cores and hyperthreading benchmarks often hide poor throughput simply by splitting the task over several low spec'ed cores.

So I completely understand how a cluster of Pi's might not be 'up to the job' in certain scenarios.

But regardless of that, the experience you are gaining is both valuable and fun !  Wink

 

My current projects are a high-performance multi-core 'Steam' gaming PC in a small ITX case,

and an always-on very low power consumption IPv6 only Minecraft server - which needs high single-core performance,

both of which I'm aiming to do before the long school summer holiday in just six or seven weeks time.

Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

What killed this were the connections to the database not because there were 20 of them but the overhead in their setup and even if I'd coded it to only use a single connection per node it may well have made things worse and defeats the purpose of course.

However, I do think it would have performed better if the code could allow the connections to be made at start up and pooled, but due to the nature (and my intended use) of the cluster the idea was to execute moduleX then / or moduleY as individual object files each with their own main function, so I could write modules of code each designed to do a specific task and then throw a task at the cluster and have it do its work. Having said that it's not the end of the world but I am a wiser guy as a result I'll just have to get better hardware.

I just hope the conversion to a Web cluster doesn't cause to many headaches regarding the WSS socket implementation.

Anonymous
Not applicable

Re: My Raspberry Pi Cluster - Was is it worth it?

With what you are attempting to do, I would give extra thought to reliability, as using multiple hardware like this reduces the mean time between failures (as a whole) because of having increased complexity.

However if the cluster constructed and coded right then the reliability can be increased, by only utilizing nodes which are reporting themselves as working and available.

Just a thought !  Wink