Get better results when you design your cache to match your applications and system

Unix Insider |  Operating Systems

So to summarize the
effects of a DNLC miss: There is a little extra CPU consumed during the
search, but a lot of sleeping -- waiting for the disk and network --
dominates the miss cost. DNLC hit rates (the number of read hits as a
proportion of all lookups) are often in the 80 to 100 percent range.


If you run the find command, which walks through the directory
structure, you will discover that the hit rate drops to perhaps 30 to 40
percent. My href="http://www.sun.com/951001/columns/adrian/column2.html"> virtual_adrian
rule for the DNLC hit rate is a bit too simple. It tells you to
increase the DNLC size if the hit rate drops below 90 percent and the
reference rate is above 100 per second. In some cases a lot of new
files are being created, or a find-like operation is needed, and there
is no point having a big DNLC.


A read miss on the name service cache causes a sequence of lookups
by the nscd that are controlled by the
/etc/nsswitch.conf file. If it contains the entry:
hosts: files nisplus dns, then the nscd first
lookup uses the standard "files backend" to look in
/etc/hosts. In recent releases of Solaris 2, the files
backend caches the file and does a hashed lookup into it. So very long
host and passwd files are searched
efficiently, and the read miss could be quite quick and CPU bound with
no waiting. A NIS or NIS+ lookup involves a call over the network to a
name server, so there's at least a few milliseconds of delay. If the
lookup is passed up a hierarchy of DNS servers across the Internet, it
could take several seconds.


The worst case is a lookup for a hostname that does not exist in a
remote DNS domain. Unfortunately, some applications repeat the same
lookup several times in quick succession, so a novel feature of the
nscd is that it supports negative caching. It remembers that a lookup
failed, and tells you immediately that the host does not exist if you
ask a second time. There is a five second timeout for negative entries
by default. The full output from nscd -g (on a recently booted Solaris
2.5 system) is shown below.


% nscd -g nscd configuration:

% nscd -g

nscd configuration:

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Operating SystemsWhite Papers & Webcasts

See more White Papers | Webcasts

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question