Viewing name service cache statistics


On the Solaris and Linux systems I support, I like to run the nscd (Name Service Cahing Daemon) daemon to cache password, group and host file data. Caching can be extremely valuable on servers that handle lots of logins, and is especially beneficial if you are authenticating your users against a directory server (it decreases the amount of traffic sent between hosts). Since nscd is unable to fill each and every request from cache, it has to periodically incur a cache miss. To see how often this occurs on a Solaris server, nscd can be run with the “-g” (print statistics) option:

$ nscd -g |more

nscd configuration:

0 server debug level
"/dev/null" is server log file

passwd cache:

Yes cache is enabled
1585148 cache hits on positive entries
0 cache hits on negative entries
1228 cache misses on positive entries
270 cache misses on negative entries
99.9% cache hit rate
0 queries deferred
13 total entries
0 complete cache invalidations
211 suggested size
600 seconds time to live for positive entries
5 seconds time to live for negative entries
20 most active entries to be kept valid

Yes check /etc/{passwd, group, hosts, inet/ipnodes} file for changes
No use possibly stale data rather than waiting for refresh

This is nifty!

This article was posted by Matty on 2006-02-08 18:42:00 -0400 -0400