name-service caching

From: Hajimu UMEMOTO <ume_at_FreeBSD.org>
Date: Sat, 29 Apr 2006 02:58:17 +0900
Hi,

>>>>> On Fri, 28 Apr 2006 14:17:45 +0100 (BST)
>>>>> Robert Watson <rwatson_at_FreeBSD.org> 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 <bushman__at__rsu.ru>
>  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_at_ 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_at_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 _at_ Internet Mutual Aid Society Yokohama, Japan
ume_at_mahoroba.org  ume_at_{,jp.}FreeBSD.org
http://www.imasy.org/~ume/
Received on Fri Apr 28 2006 - 15:58:25 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:55 UTC