Previous Page
Next Page

Name Service Cache Daemon (nscd)

nscd is a daemon that runs on a Solaris system and provides a caching mechanism for the most common name service requests. It is automatically started when the system boots to a multi-user state. nscd provides caching for the following name service databases:

  • passwd

  • group

  • hosts

  • ipnodes

  • exec_attr

  • prof_attr

  • user_attr

Because nscd is running all the time as a daemon, any nscd commands that are entered are passed to the already running daemon transparently. The behavior of nscd is managed via a configuration file /etc/nscd.conf. This file lists a number of tunable parameters for each of the supported databases listed above.

The syntax for the nscd command is shown as follows:

nscd  [-f  configuration-file]  [-g] [-e  cachename , yes | no] \
 [-i  cachename]

The options for the nscd command are described in Table 12.9.

Table 12.9. nscd Syntax



-f configuration-file

Causes nscd to read its configuration data from the specified file.


Displays current configuration and statistical data.

-e cachename, yes|no

Enables or disables the specified cache.

-i cachename

Invalidates the specified cache.

Whenever a change is made to the name service switch file, /etc/nsswitch.conf, the nscd daemon must be stopped and started so that the changes take effect. The commands to stop and start nscd have changed because the cache daemon is now managed by the Service Management Facility (SMF). The commands to use are as follows:

svcadm restart system/name-service-cache

Statistics can be obtained from nscd by running the command with the -g flag. This is the only option that can be run by a nonprivileged user. The truncated output that follows shows the results of the cache statistics for the hosts database:

#nscd -g
[...output truncated...]
hosts cache:
       Yes  cache is enabled
         44  cache hits on positive entries
         0  cache hits on negative entries
         3  cache misses on positive entries
         1  cache misses on negative entries
      91.7% cache hit rate
         0  queries deferred
         4  total entries
       211  suggested size
      3600  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
[...output truncated...]

Previous Page
Next Page