From: Greg Banks <email@example.com>
To: "firstname.lastname@example.org" <email@example.com>
Cc: Alejandro Colomar <firstname.lastname@example.org>,
Michael Kerrisk <email@example.com>,
Petr Baudis <firstname.lastname@example.org>, DJ Delorie <email@example.com>
Subject: [patch] nscd.conf.5: describe reloading, clarifications
Date: Tue, 27 Jul 2021 22:09:08 +0000 [thread overview]
Message-ID: <BL0PR2101MB13161790A220976723139258A1E99@BL0PR2101MB1316.namprd21.prod.outlook.com> (raw)
- Added a subsection of NOTES describing nscd's reloading behavior
and providing advice on how to configure it.
- Clarifications for the threads, reload-count, positive-time-to-live,
check-files, and shared attributes.
Derived by reading the nscd, libresolv and glibc source and some painful experience.
diff --git a/man5/nscd.conf.5 b/man5/nscd.conf.5
index 7356bf7c2..52f7051d5 100644
@@ -1,5 +1,6 @@
.\" Copyright (c) 1999, 2000 SuSE GmbH Nuernberg, Germany
.\" Author: Thorsten Kukuk <firstname.lastname@example.org>
+.\" Updates by Greg Banks <email@example.com> Copyright (c) 2021 Microsoft Corp.
.\" This program is free software; you can redistribute it and/or
@@ -53,9 +54,12 @@ The default is 0.
-This is the number of threads that are started to wait for
+This is the initial number of threads that are started to wait for
-At least five threads will always be created.
+At least five threads will always be created. The number of threads
+may increase dynamically up to
+in response to demand from clients, but never decreases.
@@ -83,9 +87,15 @@ Specifies the user who is allowed to request statistics.
-Limit on the number of times a cached entry gets reloaded without being used
-before it gets removed.
-The default is 5.
+Sets a limit on the number of times a cached entry gets reloaded without being used
+before it gets removed. The limit can take values ranging from 0
+to 254; values 255 or higher behave the same as
+.BR unlimited .
+Limit values can be specified in either decimal or hexadecimal with a
+"0x" prefix. The special value
+is case-insensitive. The default limit is 5. A limit of 0 turns off the reloading
+feature. See NOTES below for further discussion of reloading.
@@ -128,6 +138,9 @@ in the specified cache for
is in seconds.
Larger values increase cache hit rates and reduce mean
response times, but increase problems with cache coherence.
+Note that for some name services (including specifically DNS)
+the TTL returned from the name service is used and this attribute
@@ -166,6 +179,7 @@ The files are
.IR /etc/passwd ,
.IR /etc/group ,
.IR /etc/hosts ,
+.IR /etc/resolv.conf ,
.IR /etc/services ,
.IR /etc/netgroup .
@@ -194,6 +208,8 @@ is shared with the clients so
that they can directly search in them instead of having to ask the
daemon over the socket each time a lookup is performed.
The default is no.
+Note that a cache miss will still result in asking the daemon over
@@ -230,12 +246,82 @@ and
.IR group .
The default values stated in this manual page originate
from the source code of
.BR nscd (8)
and are used if not overridden in the configuration file.
The default values used in the configuration file of
your distribution might differ.
+.BR nscd (8)
+has a feature called reloading whose behavior can be surprising.
+Reloading is enabled when the
+attribute has a non-zero value. The default value in the source
+code enables reloading, although your distribution may differ.
+reloading is enabled, positive cached entries (the results of
+successful queries) do not simply expire when their TTL is up. Instead,
+at the expiry time
+will "reload", i.e. re-issue the same name service query that created the cached
+entry, to get a new value to cache. Depending on
+this may mean that a DNS, LDAP or NIS request is made. If the new query
+is successful reloading will repeat
+when the new value would expire, until
+reloads have happened for the entry, and only then will it actually be removed
+from the cache. A request from a client which hits the entry will reset
+the reload counter on the entry. Purging the cache using the
+command line option overrides the reload logic and removes the entry.
+Reloading has the effect of extending cache entry TTLs without compromising
+on cache coherency, at the cost of additional load on the backing name service.
+Whether this is a good idea on your system depends on details of
+your applications' behavior, your name service, and the effective TTL values of
+your cache entries. (Note that for some name services (for example, DNS), the
+effective TTL is the value returned from the name service and
+the value of the
+attribute.) Please consider the following advice carefully:
+If your application will make a second request for the same name, after
+more then 1 TTL but before
+TTLs, and is sensitive to the latency of a cache miss, then reloading may be
+a good idea for you.
+If your name service is configured to return very short TTLs, and your
+applications only make requests rarely under normal circumstances, then
+reloading may result in additional load on your backing name service
+without any benefit to applications, which is probably a bad idea for you.
+If your name service capacity is limited, reloading may have the
+surprising effect of increasing load on your name service instead of
+reducing it, and may be a bad idea for you.
+is almost never a good idea, as it will result in a cache that never expires
+entries and puts never-ending additional load on the backing name service.
+Note also that some distributions have an init script for nscd with a "reload"
+command which has the effect of purging
+.BR nscd 's
+caches using the
+commandline option. That use of the word "reload" is
+.I entirely different
+from the "reloading" described here.
.SH SEE ALSO
.BR nscd (8)
.\" .SH AUTHOR
next reply other threads:[~2021-07-27 22:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-27 22:09 Greg Banks [this message]
2021-07-28 20:31 ` [patch] nscd.conf.5: describe reloading, clarifications Alejandro Colomar (man-pages)
2021-07-29 11:55 ` nonbreaking spaces (was: [patch] nscd.conf.5: describe reloading, clarifications) G. Branden Robinson
2021-07-29 12:18 ` Alejandro Colomar (man-pages)
2021-07-29 13:58 ` G. Branden Robinson
2021-07-29 14:22 ` Alejandro Colomar (man-pages)
[not found] ` <BL0PR2101MB1316FA480EE808D34FA523EEA1F09@BL0PR2101MB1316.namprd21.prod.outlook.com>
2021-08-03 8:08 ` [patch] nscd.conf.5: describe reloading, clarifications Alejandro Colomar (man-pages)
[not found] ` <BL0PR2101MB13161815183CB7E6F5D8E61EA1F09@BL0PR2101MB1316.namprd21.prod.outlook.com>
2021-08-04 7:43 ` Alejandro Colomar (man-pages)
[not found] ` <BL0PR2101MB13161650B82F826B74E5DBD0A1F19@BL0PR2101MB1316.namprd21.prod.outlook.com>
2021-08-05 6:58 ` Alejandro Colomar (man-pages)
2021-08-05 7:38 ` G. Branden Robinson
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.