Re: [DNSOP] New Version Notification for draft-wkumari-dnsop-hammer-00.txt

Warren Kumari <warren@kumari.net> Wed, 03 July 2013 21:56 UTC

Return-Path: <warren@kumari.net>
X-Original-To: dnsop@ietfa.amsl.com
Delivered-To: dnsop@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 80F4411E8219 for <dnsop@ietfa.amsl.com>; Wed, 3 Jul 2013 14:56:40 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.228
X-Spam-Level:
X-Spam-Status: No, score=-102.228 tagged_above=-999 required=5 tests=[AWL=-0.229, BAYES_00=-2.599, J_CHICKENPOX_73=0.6, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oXZVX57GlSTz for <dnsop@ietfa.amsl.com>; Wed, 3 Jul 2013 14:56:34 -0700 (PDT)
Received: from vimes.kumari.net (smtp1.kumari.net [204.194.22.1]) by ietfa.amsl.com (Postfix) with ESMTP id 38D9B11E80EF for <dnsop@ietf.org>; Wed, 3 Jul 2013 14:56:25 -0700 (PDT)
Received: from [192.168.1.153] (unknown [66.84.81.89]) by vimes.kumari.net (Postfix) with ESMTPSA id E602B1B403E8; Wed, 3 Jul 2013 17:56:20 -0400 (EDT)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\))
From: Warren Kumari <warren@kumari.net>
In-Reply-To: <EFD28A69-40DC-4A6C-B3E7-B35BC655AF7F@vpnc.org>
Date: Wed, 03 Jul 2013 17:56:20 -0400
Content-Transfer-Encoding: quoted-printable
Message-Id: <FAFC3938-13F8-44FD-8AD9-5D71D68E1A1A@kumari.net>
References: <20130703210147.69996.qmail@joyce.lan> <EFD28A69-40DC-4A6C-B3E7-B35BC655AF7F@vpnc.org>
To: Paul Hoffman <paul.hoffman@vpnc.org>
X-Mailer: Apple Mail (2.1508)
Cc: John Levine <johnl@taugh.com>, dnsop@ietf.org
Subject: Re: [DNSOP] New Version Notification for draft-wkumari-dnsop-hammer-00.txt
X-BeenThere: dnsop@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: IETF DNSOP WG mailing list <dnsop.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dnsop>, <mailto:dnsop-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/dnsop>
List-Post: <mailto:dnsop@ietf.org>
List-Help: <mailto:dnsop-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dnsop>, <mailto:dnsop-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 03 Jul 2013 21:56:40 -0000

On Jul 3, 2013, at 5:14 PM, Paul Hoffman <paul.hoffman@vpnc.org> wrote:

> On Jul 3, 2013, at 2:01 PM, "John Levine" <johnl@taugh.com> wrote:
> 
>>>>>  If yes, message cache elements are prefetched before they expire
>>>>>  to  keep  the  cache  up to date.  Default is no.  Turning it on
>>>>>  gives about 10 percent more traffic and load on the machine, but
>>>>>  popular items do not expire from the cache.
>> 
>>> My question earlier still stands: does Unbound do what HAMMER says
>>> (waits for a request before refreshing the cache) or does it just
>>> refresh the cache automatically? The Unbound doc is unclear (at least
>>> to me).
>> 
>> If it did it automatically, I'd expect a lot more than 10% more
>> traffic.  I enabled it on my not terribly busy server and I see
>> numbers that look like they're in the 1% range:
>> 
>> Jul 03 14:23:21 unbound[40669:0] info: server stats for thread 0: 47798 queries, 20108 answers from cache, 27690 recursions, 242 prefetch
>> Jul 03 15:23:21 unbound[40669:0] info: server stats for thread 0: 53322 queries, 20319 answers from cache, 33003 recursions, 291 prefetch
>> Jul 03 16:23:21 unbound[40669:0] info: server stats for thread 0: 55260 queries, 20697 answers from cache, 34563 recursions, 272 prefetch
>> 
> 
> Those are pictures. Source code, or developer assurance, or it didn't happen ( to badly bastardize a phrase that the kids these days use ).

It *appears* to me from looking at the source that Unbound triggers upon an incoming query (basically what HAMMER suggests).
I should note that this is the first time I have looked at the Unbound source, and so it is entirely possible that I'm missing something.

It seems that worker_handle_request() in worker.c has the interesting bits.
From what I can tell, the worker will only have this sort of request if it was initiated by an incoming query.

Horrendous pseudocode seems like:
worker_handle_request()
 if answer_from_cache:
    if prefetch_ttl_expired:
       reply_and_prefetch()


/** Reply to client and perform prefetch to keep cache up to date */
reply_and_prefetch() 
  reply()
    /* create the prefetch in the mesh as a normal lookup without
	 * client addrs waiting, which has the cache blacklisted (to bypass
	 * the cache and go to the network for the data). */
	/* this (potentially) runs the mesh for the new query */
    	mesh_new_prefetch(worker->env.mesh, qinfo, flags, leeway + 
		PREFETCH_EXPIRY_ADD);


There is also a PREFETCH_EXPIRY_ADD which I don't really understand:

/** 
 * seconds to add to prefetch leeway.  This is a TTL that expires old rrsets
 * earlier than they should in order to put the new update into the cache.
 * This additional value is to make sure that if not all TTLs are equal in
 * the message to be updated(and replaced), that rrsets with up to this much
 * extra TTL are also replaced.  This means that the resulting new message
 * will have (most likely) this TTL at least, avoiding very small 'split
 * second' TTLs due to operators choosing relative primes for TTLs (or so).
 * Also has to be at least one to break ties (and overwrite cached entry).
 */
#define PREFETCH_EXPIRY_ADD 60

I must admit that I'm somewhat shaky on much of the above, it would be great if someone who is more familiar with the architecture / code could comment/


W




> 
> _______________________________________________
> DNSOP mailing list
> DNSOP@ietf.org
> https://www.ietf.org/mailman/listinfo/dnsop
> 

-- 
Do not meddle in the affairs of wizards, for they are subtle and quick to anger.  
    -- J.R.R. Tolkien