[erlang-questions] DNS is slow when run from many processes

Ivan Ostres <>
Tue Feb 8 09:51:48 CET 2011


On 8/2/11 12:50 AM, ori brost wrote:
> After checking the states of processes I see that many of them spend
> time in:
> 3>  i(0,200,0).
> [{current_function,{inet_gethost_native,getit,2}},
>
>
> What are my possibilities for better DNS? I now that I can use erlang
> dns instead of native dns, this solves the problem for 127.0.0.1, but
> when I try a real address (i.e. run(50000,"some.server.of.mine.com"))
> connections are very slow with both native and erlang DNS.
>
> Any advice on a solution?

You are doing DNS lookup for every port connect even though destination 
host does not change for whole PortCount. Did you consider doing DNS 
lookup before entering loop and cache the result? This would get you 
O(1) time for hostname lookup instead of O(n).

BR,
Ivan Ostres


More information about the erlang-questions mailing list