Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 112458
Status: rejected
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: felipe [...] felipegasper.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: feature request: recurse caching?
Date: Fri, 26 Feb 2016 10:23:50 -0600
To: bug-Net-DNS [...] rt.cpan.org
From: Felipe Gasper <felipe [...] felipegasper.com>
Is there a way to cache DNS lookups with Net::DNS::Resolver::Recurse? Presently this doesn’t seem to be a feature of the module, and the following: ------------- package My::DnsRoots::Resolver; use strict; use warnings; use base 'Net::DNS::Resolver::Recurse'; sub send { my ($self) = shift; $self->{'_cache'} ||= {}; return $self->{'_cache'}{"@_"} ||= $self->SUPER::send(@_); } *query_dorecursion = \&send; 1; -------------- … doesn’t seem to improve the performance beyond the “vanilla” version of the Recurse module. When I watch what the module is actually doing, it’ll still query “.com” multiple times on successive queries. Thank you! -Felipe Gasper Houston, TX
From: rwfranks [...] acm.org
On Fri Feb 26 11:24:05 2016, felipe@felipegasper.com wrote: Show quoted text
> Is there a way to cache DNS lookups with Net::DNS::Resolver::Recurse?
No Nameserver addresses are cached, but do not persist between queries. Net::DNS::Resolver::Recurse is a tool for inspecting delegation chains. It is wholly unsuitable for general purpose name resolution. Show quoted text
> > Presently this doesn’t seem to be a feature of the module, and the > following: > > ------------- > package My::DnsRoots::Resolver; > > use strict; > use warnings; > > use base 'Net::DNS::Resolver::Recurse'; > > sub send { > my ($self) = shift; > > $self->{'_cache'} ||= {}; > > return $self->{'_cache'}{"@_"} ||= $self->SUPER::send(@_); > } > > *query_dorecursion = \&send; > > 1; > -------------- > > … doesn’t seem to improve the performance beyond the “vanilla” version > of the Recurse module. When I watch what the module is actually doing, > it’ll still query “.com” multiple times on successive queries. >
Only the final result of each query gets stored in $self->{'_cache'}. Simple application-side caches yield very little overall performance improvement, have no means to discard outdated entries or to cache negative results. If performance is an issue, using the unmodified Net::DNS::Resolver in combination with a BIND nameserver running on the same machine, will outperform anything you can do in Perl.