From owner-freebsd-current@FreeBSD.ORG Fri Apr 28 17:58:25 2006 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6CEA416A405 for ; Fri, 28 Apr 2006 17:58:25 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from ameno.mahoroba.org (gw4.mahoroba.org [218.45.22.175]) by mx1.FreeBSD.org (Postfix) with ESMTP id AED7C43D4C for ; Fri, 28 Apr 2006 17:58:23 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from kasuga.mahoroba.org (IDENT:AL+s/ZQjpgpimzw52kG4xc6Ov3BZCSHlSMVo9vlaQphBORXzNFmxQpWum5XpyU63@kasuga-iwi.mahoroba.org [IPv6:3ffe:501:185b:8010:212:f0ff:fe52:6ac]) (user=ume mech=CRAM-MD5 bits=0) by ameno.mahoroba.org (8.13.6/8.13.6) with ESMTP/inet6 id k3SHwHB0087046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 29 Apr 2006 02:58:17 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Sat, 29 Apr 2006 02:58:17 +0900 Message-ID: From: Hajimu UMEMOTO To: current@FreeBSD.org In-Reply-To: <20060428141404.Q40418@fledge.watson.org> References: <200604281203.k3SC3da7070033@repoman.freebsd.org> <20060428141404.Q40418@fledge.watson.org> User-Agent: xcite1.38> Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.0.50 (i386-unknown-freebsd6.1) MULE/5.0 (SAKAKI) X-Operating-System: FreeBSD 6.1-RC X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.1.4 (ameno.mahoroba.org [IPv6:3ffe:501:185b:8010::1]); Sat, 29 Apr 2006 02:58:18 +0900 (JST) X-Virus-Scanned: by amavisd-new X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on ameno.mahoroba.org Cc: Michael Bushkov Subject: name-service caching X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2006 17:58:25 -0000 Hi, >>>>> On Fri, 28 Apr 2006 14:17:45 +0100 (BST) >>>>> Robert Watson said: rwatson> On Fri, 28 Apr 2006, Hajimu UMEMOTO wrote: > - Extend the nsswitch to support Services, Protocols and Rpc > databases. > - Make nsswitch support caching. > > Submitted by: Michael Bushkov > Sponsored by: Google Summer of Code 2005 rwatson> Very cool! Thanks to Michael and you for making this happen (and, of course, rwatson> Google, for helping to fund it!). I trust we're going to get a long rwatson> informative e-mail to current@ explaining how one sets it up to play with it, rwatson> what sort of performance results have been had, etc? :-) Okay, you can set it up quite easy: 1) Make sure you have /etc/cached.conf installed. 2) Put cached_enable="YES" into your /etc/rc.conf. 3) Start cached(8) by `/etc/rc.d/cached start'. 4) Put `cache' keyword to the database entries which you want to cache the result in /etc/nsswitch.conf. For example: hosts: cache files dns Please refer cached(8) and cached.conf(5) manpages for detail. Here is a result of tools/regression/lib/libc/resolv/resolv.t with some modifications to do lookup twice and output time: ume@kasuga:1019% sh ./resolv.t 1..3 29.21 real 1.29 user 0.75 sys ok 1-1 - getaddrinfo() 10.33 real 1.09 user 0.44 sys ok 1-2 - getaddrinfo() 24.07 real 0.26 user 0.77 sys ok 2-1 - gethostbyname() 19.02 real 0.22 user 0.67 sys ok 2-2 - gethostbyname() 25.04 real 0.20 user 0.78 sys ok 3-1 - getipnodebyname() 23.03 real 0.15 user 0.71 sys ok 3-2 - getipnodebyname() You can see notable performance advancement in getaddrinfo(3). Since getaddrinfo(3) does DNS query twice for each call; A RR and AAAA RR, I think that cache has a marked effect. However, it doesn't seem notable advancement in getipnodebyname(3) and gethostbyname(3). I think it is because cached(8) doesn't cache on query error like SERVFAIL. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/