[erlang-questions] Node mysteriously sends 11 MB while spawning a process on another node

Dmitry Kolesnikov dmkolesnikov@REDACTED
Fri Apr 19 17:14:06 CEST 2019


Hello

> On 19 Apr 2019, at 17.39, Filip Niksic <fniksic@REDACTED> wrote:
> 
> Now, it has to be noted that one of the arguments to the spawned process is a function closure. Could it be that this closure causes the runtime to pack all of its data structures and pass them along with the message? If so, how can such a situation be avoided? Is there some general rule of thumb that function closures should not be passed as arguments in a distributed setting?

I would bet that usage of closure function is the major reason. Passing anonymous functions causes a serialisation of its entire environment. It might easily grow to 11MB.

Some hints and discussion can be found here
http://erlang.org/pipermail/erlang-questions/2008-November/039849.html

The best practice to use fun Mod:Fun/N over fun() -> … end.

Best Regards,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190419/679f89b3/attachment.htm>


More information about the erlang-questions mailing list