[erlang-questions] Light-weight operating systems supporting Erlang in production web servers

Tristan Sloughter t@REDACTED
Sat Sep 16 17:45:30 CEST 2017


Alpine is 4-5MB (no kernel). 

And yea, in a target system much of the space is taken up by beam.smp.
On a default install that is like 19M.

I've never tried building a smaller beam.smp :)

-- 
  Tristan Sloughter
  "I am not a crackpot" - Abe Simpson
  t@REDACTED

On Sat, Sep 16, 2017, at 02:29 AM, Joe Armstrong wrote:
> Old timer here :-)
> 
> Just out of interest how large is Apline? (in MB?)
> 
> Just out of interest the last time I made a minimal erlang is ended up
> at 4.7 MB -
> with the following files (and sizes)
> 
> > /Dropbox/experiments/erlang_embedded/tiny_erl_19.1 > tree -s
> 
> ├── [      11859]  COPYRIGHT
> ├── [        238]  bin
> │   ├── [    2827272]  beam.smp
> │   ├── [      22580]  erl_child_setup
> │   ├── [      53548]  erlexec
> │   ├── [       5479]  start.boot
> │   └── [       6459]  start.script
> ├── [        896]  erl
> └── [        204]  lib
>     ├── [     429496]  compiler-7.0.2.ez
>     ├── [     387430]  kernel-5.1.ez
>     ├── [     109322]  sasl-3.0.1.ez
>     └── [     806013]  stdlib-3.1.ez
> 
> The biggest file is beam.smp -- I guess with a little static analysis
> many of the files
> in stdlib and kernel could be removed.
> 
> In the 'old days' the size to beat was 1.44 MB (ie a floppy disk) - we
> did actually have
> an entire OS + Erlang that fitted onto a single floppy disk.
> 
> I also recall a time when linux kernels were so small that a
> knowledgeable person knew what every file in the system did.
> 
> I also believe that "small is fast and secure"
> loading/storing/cacheing MBs of *anything* is
> a thousand times faster than loading/storing/caching GBs.
> 
> Security is possible (though difficult) with MBs of code - and I guess
> impossible with GB
> 
> Cheers
> 
> /Joe
> 
> 
> On Fri, Sep 15, 2017 at 10:48 PM, Tristan Sloughter <t@REDACTED>
> wrote:
> > Same, and I have an example multi-stage docker file for building the image
> > on Alpine for an example project:
> > https://github.com/SpaceTime-IoT/presence-sample/blob/master/Dockerfile It
> > also uses all the options relx supports to shrink the size of the tarball
> > https://github.com/SpaceTime-IoT/presence-sample/blob/master/rebar.config#L26-L34
> >
> > One feature relx doesn't yet support that may help a little with size of the
> > unpacked release would be compressed applications (.ez). Pretty sure that is
> > what reltool would do by default? Not sure how much it saves.
> >
> > Also, it is possible to use docker scratch* to have no real base image, but
> > with Alpine being so small I don't think it saves enough to be worth it --
> > esp considering everything you then don't have, as Phil mentioned.
> >
> > * And some hacks, copying over libs and a linker. Or a statically linked
> > Erlang? Never done it with a statically linked Erlang, would that work with
> > SSL?
> >
> > --
> >   Tristan Sloughter
> >   "I am not a crackpot" - Abe Simpson
> >   t@REDACTED
> >
> >
> > On Fri, Sep 15, 2017, at 10:14 AM, Phil Toland wrote:
> >
> > I second the vote for Alpine Linux. My application is a mix of Erlang and
> > Elixir and runs in Docker containers. I use Alpine as the base and I get
> > reasonably sized containers that don't have anything I don't need.
> >
> > As a side note, it isn't just about providing the necessary support to run
> > the BEAM VM. I also want enough of a familiar environment (ls, ps, top,
> > nslookup/dig, netstat) to troubleshoot issues. Alpine provides that without
> > the other stuff that you don't need.
> >
> > ~phil
> >
> >
> >
> > On September 15, 2017 at 9:47:00 AM, felixgallo@REDACTED
> > (felixgallo@REDACTED) wrote:
> >
> >
> >
> >
> > FreeBSD and alpine Linux have both served me well.
> >
> > F.
> >
> > On Sep 15, 2017, at 7:20 AM, Lloyd R. Prentice <lloyd@REDACTED>
> > wrote:
> >
> > Hi,
> >
> > Joe Armstrong states in his 2003 Doctor of Technology thesis:
> >
> > "Our system has very little need of an operating system. We make use of very
> > few operating system services, thus it is relatively easy to port our system
> > to specialised environments such as embedded systems."
> >
> > 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?
> >
> > All the best,
> >
> > LRP
> >
> >
> > Sent from my iPad
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >



More information about the erlang-questions mailing list