<p>Since nscd is a name service caching daemon it&#39;s what you do want to use.<br>
There are some gotchas:<br>
If the system is not running networking before nscd starts, it will never get any data as it never loads the system nameservers.<br>
Changing data in hosts will not get picked up by nscd until it&#39;s refresh time has expired. That time is a conf file option.<br>
Restarting nscd will not resolve either of these. <br>
The solution is to do a cache flush on the hosts entries in nscd. <br>
Man nscd for exact syntax.<br>
Use nscd. It&#39;s a good tool for offloading network traffic that&#39;s basically redundant data. If you set a ttl of an hour, that works well for normal use.</p>
<div class="gmail_quote">On Nov 4, 2011 8:26 AM, &quot;Chesser.Damon&quot; &lt;<a href="mailto:Damon.Chesser@suntrust.com">Damon.Chesser@suntrust.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">









<div lang="EN-US" link="blue" vlink="purple">

<div>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Thanks for the reply, that is how I thought it worked also.  As
for nscd, someone on this list said “Don’t.  Use. It.”  <u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Any other opinions on it?<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><a href="mailto:Damon@damtek.com" target="_blank">Damon@damtek.com</a><u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p>

<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">

<p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:ale-bounces@ale.org" target="_blank">ale-bounces@ale.org</a>
[mailto:<a href="mailto:ale-bounces@ale.org" target="_blank">ale-bounces@ale.org</a>] <b>On Behalf Of </b>leam hall<br>
<b>Sent:</b> Friday, November 04, 2011 8:17 AM<br>
<b>To:</b> Atlanta Linux Enthusiasts<br>
<b>Subject:</b> Re: [ale] /etc/hosts and caching<u></u><u></u></span></p>

</div>

<p class="MsoNormal"><u></u> <u></u></p>

<div>

<p class="MsoNormal">Good morning Damon!<u></u><u></u></p>

</div>

<div>

<p class="MsoNormal"> <u></u><u></u></p>

</div>

<div>

<p class="MsoNormal">As far as I can tell by editing /etc/hosts on a RHEL 4 box,
the IP addresses are not cached longer than it takes me to edit the file. I
believe your server will alwyas look in /etc/hosts anyway, per the
/etc/nsswitch.conf file. The normal hosts line is something like: <u></u><u></u></p>

<div>

<p class="MsoNormal"> <u></u><u></u></p>

</div>

<div>

<p class="MsoNormal">   hosts:      files dns<u></u><u></u></p>

</div>

</div>

<div>

<p class="MsoNormal">There is the program nscd and it&#39;s config file, ncsd.conf.
This configures some caching for you but I *think* it&#39;s more DNS related than
affecting /etc/hosts. <u></u><u></u></p>

</div>

<div>

<p class="MsoNormal">Hope that helps.<u></u><u></u></p>

</div>

<div>

<p class="MsoNormal"> <u></u><u></u></p>

</div>

<div>

<p class="MsoNormal" style="margin-bottom:12.0pt">Leam<u></u><u></u></p>

</div>

<div>

<p class="MsoNormal">On Fri, Nov 4, 2011 at 7:40 AM, Chesser.Damon &lt;<a href="mailto:Damon.Chesser@suntrust.com" target="_blank">Damon.Chesser@suntrust.com</a>&gt;
wrote:<u></u><u></u></p>

<div>

<div>

<div>

<div>

<div>

<div>

<div>

<p class="MsoNormal">This
dovetails into building a DNS caching server I asked earlier this week. 
The issue is we are seeing latency in our application and a possible (but only
possible, not proven) issue might be host lookups.  I figured that an
entry into /etc/hosts would be faster than a WAN DNS lookup especially since
the IP is static.  Someone was concerned with disk reads and that becoming
a bottleneck.  Someone else pointed out that /etc/hosts file was
cached.  <u></u><u></u></p>

<p class="MsoNormal"> <u></u><u></u></p>

<p class="MsoNormal">This
started a google search by me to find out if that was true or not.  Totally
inconclusive.  Some have reported issues with not being able to get the
Linux box to re-read the hosts file after a change was committed short of a
reboot or init restart.  Others have said just make the change and it
shows up.  I have not found any documentation saying whether it was cached
or not.  Any smart guys know the answer or can provide any documentation
on that?  It’s kind of funny, you think you KNOW something until someone
says “Prove it”.<u></u><u></u></p>

<p class="MsoNormal"> <u></u><u></u></p>

<p class="MsoNormal"><a href="mailto:Damon@damtek.com" target="_blank">Damon@damtek.com</a><u></u><u></u></p>

<p class="MsoNormal"> <u></u><u></u></p>

</div>

</div>

<div>

<p class="MsoNormal"> <span style="font-family:Courier"> <u></u><u></u></span></p>

</div>

<div>

<p class="MsoNormal"><span style="font-family:Courier"> <u></u><u></u></span></p>

</div>

<div>

<p class="MsoNormal"><span style="font-family:Courier"> <u></u><u></u></span></p>

</div>

<div>

<p class="MsoNormal">LEGAL DISCLAIMER<br>
The information transmitted is intended solely for the individual or entity to
which it is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of or taking action in
reliance upon this information by persons or entities other than the intended
recipient is prohibited. If you have received this email in error please
contact the sender and delete the material from any computer.<br>
 <br>
SunTrust is a federally registered service mark of SunTrust Banks, Inc. Live
Solid. Bank Solid. is a service mark of SunTrust Banks, Inc.<br>
[ST:XCL]<span style="font-family:Courier"> <u></u><u></u></span></p>

</div>

</div>

</div>

</div>

</div>

</div>

<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><u></u><u></u></p>

</div>

<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <u></u><u></u></p>

<div>

<p class="MsoNormal"><a href="http://leamhall.blogspot.com/" target="_blank">Mind
on a Mission</a><u></u><u></u></p>

</div>

<p class="MsoNormal"><u></u> <u></u></p>

</div>

</div>


<br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div>