[erlang-questions] Light-weight operating systems supporting Erlang in production web servers
zxq9
zxq9@REDACTED
Sat Sep 16 02:38:13 CEST 2017
On 2017年09月15日 金曜日 10:20:15 Lloyd R. Prentice wrote:
> As a one-time Forth developer, software bloat offends me. I sigh and use Ubuntu on my development system out laziness and convenience.
>
> But I would like my production servers to be lean and mean.
>
> What light weight open-source off-the shelf operating systems would battle-hardened Erlang gurus recommend?
I've found success getting very lean, highly efficient systems using Gentoo. It is about halfway between being "off-the-shelf" and a prepackaged system like the others. Gentoo is a meta distribution, not really a distribution, so you choose exactly what you want your custom distro to look like and have it built that way.
For systems where I've chosen the hardware (or virtual host environment) and I'm going to run Erlang only that means:
- The kernel modules necessary to drive the hardware
- The basics: coreutils, bash, vim
- Erlang dependencies: enough of gcc, openssl, etc. to build Erlang properly
- Extra utilities the system might depend on: Postgres, Mercury, a graph db, etc.
Beyond that, as long as I write everything else in Erlang (independent services like Postgres aside) then my from source system retrieves and runs the latest version of everything. As long as I stick to the same hardware I have the Gentoo profile continue to build up to date binaries whenever something changes and distribute those to the service hosts.
I've found this to be a really good fit for situations where you have 1-5 systems or >100 systems. With just a few systems you can have the systems rebuild themselves, maintaining it occasionally is not a hassle, and setting up a binary repo isn't worth it. With hundreds or thousands of hosts you will have a sysop who can keep an eye on things, setting up a binary repo is totally worth it, and everything just sort of works in a way that operations and development don't have to be intimate (host maintenance takes very little time for the systems guys in this case once things are set up). Where Gentoo really doesn't fit is that fuzzy space where you have just enough systems to maintain that it is a painful and distracting task but not enough to make having dedicated sysop support necessary. Unfortunately, most projects fit into that uncomfortable middle size, and so we see a proliferation of wonky partial solutions to handle that semi-scaled space.
In my experience there is no reasonable way to discuss how lean the system is going to be without addressing how lean the support structure for that system is going to be. In the end we have to write our systems to handle human problems, and that means also addressing human concerns on the back end. Sometimes being lazy and just tossing Debian or Ubuntu out there is really the right solution -- to the point that I favor VMs over containers because nobody has to learn or keep up with any quirks and that's usually the biggest time sink, not execution efficiency. Take care to write your system in a way that you don't wind up marrying a particular flavor of hose unless you have to (and sometimes you have to, at least on the client side). I've found so far that if I write the core system in pure Erlang (avoiding native code) I have zero problems changing the host later -- and that gives me quite a lot of freedom.
It has been very rare that a performance issue was so crushingly problematic that I needed NIFs or port drivers -- usually I need a system written in something totally different that I can talk to over the wire. Using the network socket as your universal abstraction is immensely powerful in this regard, allowing you to experiment with whatever platform whims you come up with in the future.
My 2 bucks.
-Craig
More information about the erlang-questions
mailing list