POE::Component::Client::DNS woes

2005-04-28 Thread Lari Huttunen
Dear all,

I have been trying to wrap my brain around the POE framework for a
couple of days reading through the docs and trying out different
things. I managed to modify the reference implementation of concurrent
DNS resolver URL:http://poe.perl.org/?POE_Cookbook/DNS_Lookups to a
PERL package, which expects an array ref of IP addresses as input and
returns a hash ref of ip to name mappings as output. This now seems to
work fine, except for the fact that the resolvers utilize only the
first nameserver on the list passed to Net::DNS::Resolver, i.e.

POE::Component::Client::DNS-spawn(
Alias  = 'resolver',
Timeout= 30,
Nameservers = [qw(10.0.0.1 10.0.0.2 10.0.0.3)],
);

will only query the first server on the list (the test material
consisted of about hundred IP adresses).

10.0.0.10.1443  10.0.0.1.53: PTR? nn.nn.nn.nn.in-addr.arpa. (44)
10.0.0.10.1444  10.0.0.1.53: PTR? nn.nn.nn.nn.in-addr.arpa. (43)
..

In other words the resolution seems to working in parallel, but only
the first name server is queried.  I have set the number of parallel
workers to 9 through:

sub INITIAL_COUNT () { 9 }

This doesn't seem a bug in POE unless passing the Nameservers parameter
in POE::Component::Client::DNS is somehow botched, which does not seem 
to be the case. Reading the source code for Net::DNS::Resolver did not
yield any obvious answers either. 

Any suggestions?

Anyway, thanks for the developers and contributors for a great 
parallel programming framework! :) The learning curve is steep 
but at least I have been able to take the first wobbly steps through
perusing the rather extensive but distributed documentation. ;)

-- 
Sincerely,

Lari Huttunen



Re: POE::Component::Client::DNS woes

2005-04-28 Thread Mathieu Longtin
Hum, if the first DNS servers works, why should it try the
other ones?

--- Lari Huttunen [EMAIL PROTECTED] wrote:
 Dear all,
 
 I have been trying to wrap my brain around the POE
 framework for a
 couple of days reading through the docs and trying out
 different
 things. I managed to modify the reference implementation
 of concurrent
 DNS resolver
 URL:http://poe.perl.org/?POE_Cookbook/DNS_Lookups to a
 PERL package, which expects an array ref of IP addresses
 as input and
 returns a hash ref of ip to name mappings as output. This
 now seems to
 work fine, except for the fact that the resolvers utilize
 only the
 first nameserver on the list passed to
 Net::DNS::Resolver, i.e.
 
 POE::Component::Client::DNS-spawn(
 Alias  = 'resolver',
 Timeout= 30,
 Nameservers = [qw(10.0.0.1 10.0.0.2 10.0.0.3)],
 );
 
 will only query the first server on the list (the test
 material
 consisted of about hundred IP adresses).
 
 10.0.0.10.1443  10.0.0.1.53: PTR?
 nn.nn.nn.nn.in-addr.arpa. (44)
 10.0.0.10.1444  10.0.0.1.53: PTR?
 nn.nn.nn.nn.in-addr.arpa. (43)
 ..
 
 In other words the resolution seems to working in
 parallel, but only
 the first name server is queried.  I have set the number
 of parallel
 workers to 9 through:
 
 sub INITIAL_COUNT () { 9 }
 
 This doesn't seem a bug in POE unless passing the
 Nameservers parameter
 in POE::Component::Client::DNS is somehow botched, which
 does not seem 
 to be the case. Reading the source code for
 Net::DNS::Resolver did not
 yield any obvious answers either. 
 
 Any suggestions?
 
 Anyway, thanks for the developers and contributors for a
 great 
 parallel programming framework! :) The learning curve is
 steep 
 but at least I have been able to take the first wobbly
 steps through
 perusing the rather extensive but distributed
 documentation. ;)
 
 -- 
 Sincerely,
 
 Lari Huttunen
 
 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: Fwd: Re: POE::Component::Client::DNS woes

2005-04-28 Thread Lance_Braswell




Untested: spawn several several PoCo::Client::DNS aliases. You could
either strictly round-robin your posting to the spawned resolvers in
start_next_lookup. Or, if you really want to balance things out, keep up
with how many queries each resolver is currently handling by incrementing
some counter at the start of start_next_lookup and decrementing it in
got_answer. Then choose a resolver accordingly (don't forget to randomly
pick from resolvers that are available).
-
Lance Braswell - + 1 469 357 6112


   
 Lari Huttunen   
 [EMAIL PROTECTED] 
 tu.netTo 
   poe@perl.org  
 04/28/2005 01:45   cc 
 PM
   Subject 
   Fwd: Re:
 Please respond to POE::Component::Client::DNS woes
 [EMAIL PROTECTED] 
  tu.net  
   
   
   
   




Oops, sorry forgot to CC: the list.

--  Original Message  --
Subject: Re: POE::Component::Client::DNS woes
To:  Mathieu Longtin [EMAIL PROTECTED]
From:Lari Huttunen [EMAIL PROTECTED]
Date:Thu, 28 Apr 2005 21:39:57 +0300


On 21:00:51 28/04/2005 Mathieu Longtin [EMAIL PROTECTED] wrote:
 Hum, if the first DNS servers works, why should it try the
 other ones?

To even out the query load between the different servers, but yes I see
your point. :) Which means that I will probably have implement some kind
of a round-robin logic for the queries, maybe? I would like to use the
exisiting modules but what I was looking for is distribution of the query
load between many different nameservers.

--
Sincerely,

Lari Huttunen