[TriLUG] Name server

Hrivnak, Michael mhrivnak at hrivnak.org
Sat Feb 22 21:19:43 EST 2014


I'd let bind (or something similar) be the caching nameserver, and just
make sure that it gets queried for each domain right after expiration. You
can get the TTL like so:

$ dig trilug.org +noall +answer | tail -n 1 | awk '{ print $2 }'

... and then make sure some thread wakes up at the appropriate time in the
future to make a new query against your caching server. It can get more
complicated of course, for example when CNAME records are involved. But
since you're looking for a programming exercise, that'll be part of the
fun. :)

This doesn't help you identify the most frequently accesses records, but
that might be better done separately. There are lots of different criteria
you could decide on for which records to cache, and different ways to
collect actual usage data. In some ways, this could be the more interesting
part of the project.

I think I recall that you've done python in the past. If you're looking to
stay with that, you might consider using celery with a custom scheduler
("celery beat"). It's probably overkill for this problem, but would be a
fun reason to get familiar with how celery beat works. In terms of coding,
I think you could accomplish this with very little effort. Hint: subclass
ScheduleEntry class with a custom "is_due" method, which would be very easy
to implement. I've been in this area recently, so let me know if you'd like
further elaboration.

Or to try something new, check out http://golang.org. It's a great language
that makes concurrency easy and simple. It's a relatively young language,
but it's getting a lot of attention.

Good luck,
Michael


On Sat, Feb 22, 2014 at 7:39 PM, Igor Partola <igor at igorpartola.com> wrote:

> Coding practice is one reason. I can use this as an opportunity to learn
> more about the innards of DNS.
>
> Practically, I run bind9 on my home server so I already get most of the
> benefits, except that because of the particulars of my network and the
> crappiness of my ISP a request can take either 40ms or 1200ms to resolve: a
> noticeable amount of time on any given web page. Seeing as most of the
> domains I visit have a TTL on the order of hours I could easily speed up
> the perceived speed of web browsing at my house by making sure that most
> DNS request are resolved from a local cache. The goal here is not to just
> have a caching server, but to actually never let it expire by making a
> request before it does.
>
> An alternative approach I considered was to scan bind's logs and just make
> frequent request based on that, say once an hour. However, then I would not
> learn much and the approach would not be nearly as foolproof.
>
> Igor
>
> > On Feb 22, 2014, at 6:44 PM, Jonathan Mainguy <jon at jmainguy.com> wrote:
> >
> > In all seriousness. What is the benefit of doing this? Other then coding
> > practice.
> --
> This message was sent to: Michael Hrivnak <mhrivnak at hrivnak.org>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that
> address.
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web  :
> http://www.trilug.org/mailman/options/trilug/mhrivnak%40hrivnak.org
> Welcome to TriLUG: http://trilug.org/welcome
>


More information about the TriLUG mailing list