[erlang-questions] Number of dns resolvers

Konstantin Sorokin <>
Tue Mar 2 21:44:42 CET 2010


On Tue, Mar 2, 2010 at 12:24 AM, Geoff Cant <> wrote:
> Konstantin Sorokin <> writes:
>
>> Hello!
>>
>> How do I control number of dns resolvers in Erlang VM ? As far as I
>> can see by default there are only 4 DNS resolvers (inet_gethost port
>> processes) and if my app performs massive DNS lookups in many parallel
>> processes then I probably should increase that number, right ? Are
>> there any other parameters that I can tweak to increase DNS lookup
>> speed ?
>
> There seems to be an undocumented? kernel configuration parameter
> 'gethost_poolsize'::non_neg_integer() that specifies this.
>
> As an alternative to using the c resolver (the 'native' resolver) you
> could use OTP's erlang DNS client - the 'dns' resolver.
>
> Specifying "{lookup, [dns]}." in your inetrc should do that (and erl
> -kernel inetrc '"/some/path/inetrc"'). I don't think there's any
> concurrency limit on it except the number of udp sockets you can open.
>

I tried to use your tip, but without success. Config file I wrote
looks like this:

{resolv_conf, "/etc/resolv.conf"}.
{file, hosts, "/etc/hosts"}.
{edns, 0}.
{cache_size, 0}.
{lookup, [dns]}.

and was almost copy-pasted from this page:
http://ftp.sunet.se/pub/lang/erlang/doc/apps/erts/inet_cfg.html (7.3
User Configuration Example). Nevertheless,
when I tried to use it with an Erlang shell, I've got following weird
error message:

$ erl  -kernel inetrc "'/home/kvs/.erl_inetrc'"
{error_logger,{{2010,3,2},{23,40,21}},"inet_config: syntax error in
~s~n",['/home/kvs/.erl_inetrc']}
Erlang (BEAM) emulator version 5.6.5 [source] [64-bit] [smp:2]
[async-threads:0] [hipe] [kernel-poll:false]


=ERROR REPORT==== 2-Mar-2010::23:40:21 ===
inet_config: syntax error in /home/kvs/.erl_inetrc
Eshell V5.6.5  (abort with ^G)
1>

-- 
Konstantin Sorokin


More information about the erlang-questions mailing list