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

Unix Insider |  Operating Systems

example, a call to gethostbyname() ordinarily would
involve a search through the local /etc/hosts file, a call
to a local NIS or NIS+ server, and perhaps a DNS lookup, as specified
in /etc/nsswitch.conf. The nscd provides a
system-wide cache for the results of these searches and
gethostbyname accesses it through a very fast new
inter-process call mechanism known as a door-call.

If you are debugging a name service problem, you may notice the door
system call, and many people wonder what it is. The manual page in
Solaris 2.5 and 2.5.1 describes it as experimental, unpublished, and
subject to change, but if you look on the Sun Labs research site, you
can find a description of it as part of the experimental SpringOS
object oriented operating system. The command
nscd -g will show you the statistics for the name service
cache. The read-hit cost is a few tens of microseconds, depending on
your CPU speed (yes, doors are very fast....).

Cache reads that miss the cache

If the search fails and the data is not in the cache, it is called a
read-miss. The rate at which this occurs is called the read-miss rate,
and the time taken is called the read-miss cost. A read miss
corresponds to the work that would be needed if the cache did not
exist, plus the added overhead of checking the cache. Read misses are
slow, and the read miss cost can be unpredictable, although it is
usually possible to figure out the best case, the worst case, and the

CPU caches come in many configurations; the most common setup is to
have two separate primary caches built into the CPU chip -- one to hold
instructions, and one to hold data -- often holding about 16 kilobytes
each. These caches then refer to an external level two cache holding
between 256 kilobytes and 4 megabytes of data. If there is a read miss
in the small primary cache, it may result in a hit or a miss in the
level two cache.

A level two hit takes a few cycles longer than a level one hit, but
is still very efficient. A level two miss involves a main memory
reference. In a multiprocessor system, it is necessary to access the
backplane and check every CPU cache in the system as well. If the
backplane is already very busy, there may be a considerable extra
delay. This is why heavily loaded multiprocessor servers run faster and
scale better with the reduced number of read misses that come with
larger CPU caches.

For example, Sun currently offers a choice of 512 kilobytes or 1
megabyte caches for the Enterprise Server range.

Join us:






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.

Ask a Question