This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Speeding up nscd


On Wed, Dec 26, 2012 at 11:11:47AM +0200, Dimitrios Apostolou wrote:
> Hi Siddhesh,
> 
> On Wed, 26 Dec 2012, Siddhesh Poyarekar wrote:
> >
> >* Linux-specific: Use the kernel notify interface (or something
> > similar) to asynchronously reinitialize the resolver when a change
> > is detected.
> >
> >* Memory map resolv.conf and iterate through the nameservers
> > everytime, like we do for hosts.  Really bad for performance and
> > hence I'd think this would get a 'no'.
> 
> Why not share a small memory segment among all processes with the
> resolv.conf contents in binary form. Whenever a process parses
> resolv.conf, it should also update the SHM file. So it would be
> updated by firefox or networkmanager, or whoever calls res_init(),
> but all processes will profit. Optionally re-parsing could happen
> without even res_init(), but on the first timeout. Since this would
> be system wide, the overhead will be for a single process only.
> 
> I'm thinking that ideally all caching of resolved and unresolvable
> names should happen in a common place for all processes, and this
> could happen with shared memory better than with separate daemon.
> But I'm probably taking this too far.
> 
This won't work for security reasons. Any user could modify cache to
redirect everybody's traffic to evil.com.

However it could be possible for nscd to export its cache as read-only 
mmaped file to avoid context switches on cached entries. 

Then another question is how persudate distributions to use nscd. Debian
description is:
 A daemon which handles passwd, group and host lookups
 for running programs and caches the results for the next
 query. You should install this package only if you use
 slow Services like LDAP, NIS or NIS+


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]