[erlang-questions] Node mysteriously sends 11 MB while spawning a process on another node
Fri Apr 19 17:14:06 CEST 2019
> 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
The best practice to use fun Mod:Fun/N over fun() -> … end.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions