[erlang-questions] Number of dns resolvers

Geoff Cant nem@REDACTED
Tue Mar 2 22:18:35 CET 2010


Konstantin Sorokin <kvs@REDACTED> writes:

> On Tue, Mar 2, 2010 at 12:24 AM, Geoff Cant <nem@REDACTED> wrote:
>> Konstantin Sorokin <kvs@REDACTED> 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]

You're using Erlang/OTP R12B5, the edns option was only introduced in
R13 I think. If you drop the 'edns' option it should work in R12.

Cheers,
-- 
Geoff Cant


More information about the erlang-questions mailing list