name-service caching
Hajimu UMEMOTO
ume at FreeBSD.org
Fri Apr 28 17:58:25 UTC 2006
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@ 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 @ Internet Mutual Aid Society Yokohama, Japan
ume at mahoroba.org ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/
More information about the freebsd-current
mailing list