[erlang-questions] VM with 32MB RAM

Robert Raschke <>
Mon Jul 10 20:08:00 CEST 2017


Hi Dmitry,

if I remember correctly, the embedded mode loads all code for the required
applications of your system, whereas interactive loads modules as required.
The embedded approach has the benefit of knowing exactly how much memory
your code takes up. As well as moving the loading to the start.

For specialist systems, you could create cut down versions of your
applications to only include the modules you are actually using. You are
likely to need all of kernel, but beyond that there is scope for
minimization ☺

No idea though why embedded mode would be default for relx. Personally,
unless I had good reason to otherwise, I'd always opt for interactive.
Biggest downside is missing code you only get told about late.

Hope this helps,
Robby



On 10 Jul 2017 18:23, "Dmitry Kolesnikov" <> wrote:

Hello,

I’ve never raise a memory concern for Erlang application in the cloud.
Recently, I though to fit as many independent Erlang releases as possible
into cloud container cluster (AWS ECS). The memory is one of the dimension
you have to control and provision, you need to declare application initial
RAM and reserve its expansion.

Reading the Erlang documentation
http://erlang.org/faq/implementations.html

"People successfully run the Ericsson implementation of Erlang on systems
with as little as 16MByte of RAM. It is reasonably straightforward to fit
Erlang itself into 2MByte of persistent storage (e.g. a flash disk)."

The VM claims significant amount of `system` memory when release is booted
with embedded code loading strategy.  For example a simples web echo server
might require up to 45MB of memory with total initial memory budget for the
application over 50MB. The interactive code loading strategy relax `system`
memory consumption to 18MB with total application budget under 32MB. The
`system` memory do not grow significantly (+/- 5MB) during the life cycle
of this application.

Here is some questions

* Why there is such huge difference of system memory usage between embedded
and interactive code loading strategy? It seems to me that embedded model
load almost OTP libraries into memory even half of them are really used in
the application?

* The default code loading strategy is interactive for OTP but relx makes
it embedded. Why?
https://github.com/erlware/relx/blob/master/priv/templates/extended_bin#L37

* What is your experience to use interactive code loading in the CLOUD
production systems? Frankly speaking, I’ve always used embedded mode.

* Do you see an other techniques to reduce memory consumption besides
32-bit system and half-word emulator?

Best Regards,
Dmitry
_______________________________________________
erlang-questions mailing list

http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170710/6fbcb587/attachment.html>


More information about the erlang-questions mailing list