[erlang-questions] escript: faster startup and connect to TargetNode

Frank Muller <>
Mon Dec 19 07:17:44 CET 2016


Hi everyone,

I’ve an escript which connects to a TargetNode using this code (snippet
from Basho's nodetool):
https://github.com/basho/rebar/blob/develop/priv/templates/simplenode.nodetool#L34-L45

    %% See if the node is currently running  -- if it's not, we'll bail
    case {net_kernel:hidden_connect_node(TargetNode),
          net_adm:ping(TargetNode)} of
        {true, pong} ->
            ok;
        {false,pong} ->
            io:format("Failed to connect to node ~p .\n", [TargetNode]),
            halt(1);
        {_, pang} ->
            io:format("Node ~p not responding to pings.\n", [TargetNode]),
            halt(1)
    end,

It works perfectly well, but it’s kind of slow. I mean the connection is a
bit slow to be established even it the TargetNode is running on the same
host.
Can we make it faster? Is there another way to connect to a TargetNoode
without using net_kernel module?

Finally, what kind of escript's options can make the startup faster in
general?
I found this one:
-compile(native).

Thank you
/Frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161219/a9048a4d/attachment.html>


More information about the erlang-questions mailing list