5
votes

The environment is archlinux running in virtual machine.

Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.0.2) - press Ctrl+C to exit (type h() ENTER for help)

If I run erl or iex, this will take like 8~9 seconds to start.

But if I run erl -name xxx or iex --name xxx, there is no delay at all.

While erl -sname xxx or iex --sname xxx not working, takes 8 seconds or more.

So the question is: Is there any way to skip the delay?

2

2 Answers

7
votes

I just realized that my erl prompt shows ([email protected])1>

Turns out I skipped the step that add hostname to /etc/hosts when installing Archlinux.

So I add that line, prompt shows 1> now, and starts instant. Problem solved.

4
votes

You can use strace to check what's going on.

Start an Erlang node without support for distribution and trace its behaviour. A report is produced as soon as you close the Erlang node. Results will be sorted by relative time in descending order, so look at the top to see what takes time.

strace -c -f -r erl

Compare it with an Erlang node with distribution enabled:

strace -c -f -r erl -name pigeon

Let's say you find out that "open" is what takes time. You can restrict the analysis to that system call and get some more verbose output by trying:

strace -e open -f -r erl

Let us know if you find anything interesting.