
Serverless Raspberry Pi Cluster with Docker - alexellisuk
https://blog.alexellis.io/your-serverless-raspberry-pi-cluster/
======
mrmondo
> 'Serverless is an architectural pattern resulting in: Functions as a
> Service, or FaaS'

Then call it FaaS - it's not serverless and that term is misleading, marketing
bunk. Even the title of the post describes the servers used in it's
deployment, I'm quite sick of this term - I don't find it at all helpful when
describing application architecture.

~~~
zwischenzug
I disagree; I find it very helpful.

It's not terribly complicated either - if you are only concerned with code,
then your deployment is 'serverless' in the sense that _you are not concerned
with servers_.

Of course 'servers' are involved; the point is whether that's of concern to
your deployment.

~~~
icebraining
I'm not sure that distinction is clear. For example, in AWS Lambda, you still
have issues like functions being "warm" or not, and people write code
specifically to handle that. Meanwhile, nowadays you can acquire and configure
even dedicated machines using just code.

~~~
joseph
If you have to configure a machine, even in code, then you aren't
"serverless". To me, serverless means that you do not manage the machines or
even have direct access to them.

~~~
icebraining
What's a machine? :) A dedicated server sure is, but a VPS? An Heroku Dyno?
What's the line?

~~~
monkmartinez
> What's a machine?

I would say "machine" means the hardware and/or the operating system of the
"server" (which is a fancy word for "computer").

The "and/or" part being very important!

------
elcapitan
This may be a stupid question, but is there an actual use case for building
clusters of raspberry pi's?

~~~
zeta0134
Part of me wants to believe that a solar powered raspberry pi cluster has a
legitimate use case. The things use like ~1W of power, so the board itself is
surprisingly efficient compared to a "real" server.

But really, I think the primary use case is cost. Actually having access to
that many physical machines to play with in a classroom or home learning
environment is sort of new! The market hasn't really had such accessible linux
computers at "Ehh, if it breaks I'll just buy a new one, no big deal" prices.
It's educational, and the more stable the ARM support is, the better a
student's skills will transfer over into the real world of systems
administration.

~~~
creshal
> _The things use like ~1W of power, so the board itself is surprisingly
> efficient compared to a "real" server._

Try 3.5 watts[1], not counting overhead of most USB power bricks being
incredibly inefficient.

A current-gen 35W laptop CPU will be some 10 times faster[2] as a RasPi, have
_much_ faster storage available (SATA3 or NVMe versus… USB2), _much_ faster
I/O (GBit LAN and GBit Wifi versus… USB2), and a lot of other benefits. (Like
an integrated screen and battery and keyboard and …) It also won't need
external hardware to communicate with other cluster members – that 10-port
ethernet switch will need power, too.

 _One_ RasPi is relatively energy efficient; RasPi clusters… not so much.

> _But really, I think the primary use case is cost._

Indeed.

[1] [http://raspi.tv/2016/how-much-power-does-raspberry-
pi3b-use-...](http://raspi.tv/2016/how-much-power-does-raspberry-pi3b-use-how-
fast-is-it-compared-to-pi2b) , see the numbers for "Multi-threaded CPU Tests",
which is the most applicable for server workloads

[2] Running that script manages ~9 runs/second on an i7-6700HQ, vs. ~0.9
run/second on a RPi3.

~~~
marmaduke
6700HQ is 45 W TDP?

~~~
jtuente
There are 35W configurations

[http://ark.intel.com/products/88967/Intel-Core-i7-6700HQ-
Pro...](http://ark.intel.com/products/88967/Intel-Core-i7-6700HQ-
Processor-6M-Cache-up-to-3_50-GHz)

~~~
wulfklaue
/Looks at price...

Gets you 11 Pi's ... Gets you only 1 Intel CPU, no memory, motherboard,
heatsink, fans.

Reminds me of the Celeron® Processor J3455... 10W rating on Intel there page.
On AVERAGE! Then when you see the real power usage under load for MB + CPU +
16GB memory, its actually doing 35W.

Where as the Pi's are doing 3.7W max per piece. So even with 4 pieces to match
the performance, your still half the wattage.

If Intel really scaled that good in power vs performance, why are we not
seeing x86 phones all the time?

------
metakermit
If you still like going "serverful", but want an easy method of deploying to
your Raspberry Pi using Docker, check out this open source Docker Hub for ARM
alternative

[https://marina.io/](https://marina.io/)

(Full disclosure: I am one of the authors)

~~~
alexellisuk
Marina looks very cool and I'll take a look at it soon. Let's get in contact
somehow.

~~~
metakermit
Sure, that would be great. Yeah you have our email and other contacts on –
[https://cloudfleet.io/](https://cloudfleet.io/) or mine directly on
[https://metakermit.com/](https://metakermit.com/)

------
gkya
Does anybody really use this FaaS thing? This is the weirdest of the New
Things I've seen recently.

~~~
bananarepdev
Like most new tech, it has it's applicability. Depending on your needs, and
the characteristics of your application load, it can save you money.

~~~
dvfjsdhgfv
Could you give an example of a scenario where it can actually save me money?

~~~
jclulow
I suspect it makes economic sense only when your workload is relatively
elastic, having a relatively low duty cycle. The ability to pay less when you
aren't actually using any resources is likely of more economic benefit as it
becomes more fine-grained. If you aren't in that position, other models of
lease or ownership of computing resources probably merit consideration.

~~~
dvfjsdhgfv
Well, to be honest I pay 40€/month for a baremetal server (i7 SkyLake, 64 GB
RAM, 4TB HDD). It's a powerful machine running many services, including a few
virtual machines. I consider whatever it does would qualify as low-duty. Now,
I know that each month I'm paying 40€ for all this. The last time about I read
about serverless was when someone directly discovered the money saving part is
quite tricky:
[https://news.ycombinator.com/item?id=14982220](https://news.ycombinator.com/item?id=14982220).

------
zxcmx
This is super awesome and fun but personally I had to migrate my micro
datacenter from pis to nucs.

The "armhf tax" is that you tend to have to build your own images for stuff :(
Then you need your own build infra (or "heath robinson" qemu builds) because
pis run out of memory building a lot of stuff... but mainly if C++ is involved
so ymmv.

That said, I got a rack of 8 pis doing nothing right now, so...

(unrelated
[http://www.bitscope.com/product/BB04/](http://www.bitscope.com/product/BB04/)
is handy if you want to rack a lotta pis, not affliated...)

There is probably a micro business for someone running a slick docker build
system for armhf handling the qemu emulation or toolchain dirtiness "under the
hood" in the cloud somewhere, on x86-64 boxes with a lot more than 1GB of RAM.

~~~
jacobush
You could try running a Raspberry but add a Network Block device from another
machine and. (xNBD:
[https://bitbucket.org/hirofuchi/xnbd/wiki/Home](https://bitbucket.org/hirofuchi/xnbd/wiki/Home)
)

Then export a RAM disk from that machine and add the NBD disk as swap on the
Raspberry. It would be slow, but builds would complete. Then you'd need only
one low-to-moderate power machine (a PC presumably) in your Raspberry cluster,
just with lots of RAM in the one PC.

~~~
Artemis2
Scaleway has a good array of ARM cloud offerings:
[https://www.scaleway.com/armv8-cloud-
servers/](https://www.scaleway.com/armv8-cloud-servers/)

Could this work for speeding up builds of ARM images and then deploying
locally?

~~~
alexellisuk
Packet.net can go one further - take those 8 cores and upgrade to 96 cores and
120GB RAM.. it's ARMv8 which will be next for OpenFaaS when the Docker support
catches up :-)

------
lngnmn
Serverless meme means that all I got is a chrooted directory with only systemd
and /lib but without signals, similar to an apache vhost with a cgi-bin, so I
could run my full-stack crap and it is supposed to be so damn cool because
actual server maintenance is now someone else's problem?

------
Hortinstein
great article, been a huge fan of your stuff in the past. Helped me get some
good ideas of things to use my Pi and Clusterhat with.
[https://clusterhat.com](https://clusterhat.com)

------
syvanen
So this blog instructs to install commercial docker instead of moby. I wonder
how the licensing goes if you were to use this.

~~~
filipn
I believe it actually installs the Docker community edition (CE) which is
under the Apache 2.0 license. Docker (the product) is assembled using the Moby
libraries and components.

~~~
alexellisuk
Correct, Moby is not a distribution of a container runtime.. it's not the
"docker" you are looking for. Docker CE is and that's what's used in the
guide.

------
imtringued
I'm surprised that the raspberry pi monoculture prevailed even until today.

