You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by David Robinson <dr...@ast.cam.ac.uk> on 1995/03/22 16:25:00 UTC

Nameserver cache

After some thought, I have become more and more convinced that rst's nameserver
cache is an important enhancement (especially for those of us stuck with NIS+).
The use of mmap was not portable, so I've rewritten it to use pipe, read and
write.

The cache is maintained by the parent process. New data is sent back to
the parent httpd via a pipe, using non-blocking I/O. That way, there are
no problems with locking, as the cache is not in shared memory. The only
assumption I make is that small reads/writes over a pipe are atomic, even
on MP machines.

I use a cache size of 100 entries, occupying 5200 bytes, i.e. one extra
memory page. The additional memory use is negligable. As well as hostnames,
it also caches successful DNS queries which result in no data.

Simulations based on accesses to our site (which does not have many in-line
images) show a hit rate of 90%, i.e. a reduction in name-lookups of a factor
of 10.

I now get an http response time on a sparc classic of 150ms. (for a cache hit.)

I've uploaded the code as P12-nscache-2.txt.

 David.

Re: Nameserver cache

Posted by Brian Behlendorf <br...@wired.com>.
On Wed, 22 Mar 1995, Simon Spero wrote:
> This may or may not be atypical; 100 entries took me to about 70% on a 
> typical sunsite trace , which suprised me. 210 entries got me to the 90% 
> mark. If you're using pipes, though, you might as well cheat and use a 
> local caching named; UDP is quite fast to localhost, and if you move to 
> persistent processes, you can just set up a TCP connection and keep it 
> buzzing.

So... I'd like to see some performance tests between 
1) rst's nameserver cache 
2) David's pipes-based but more portable cache 
3) running a local named.  

If there's not an appreciable difference between 2 and 3 then I'd say 
let's leave it out - if there is a huge difference between 1 and 3 on 
platforms with mmap then let's leave it in as a #DEFINE.

We still need a good solid test suite - I just discovered one of the 
patches I recommended yesterday is dumping core on /cgi-bin/printenv.. 
ugh...

	Brian

--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@hotwired.com  brian@hyperreal.com  http://www.hotwired.com/Staff/brian/


Re: Nameserver cache

Posted by Simon Spero <se...@tipper.oit.unc.edu>.

On Wed, 22 Mar 1995, David Robinson wrote:

> 
> I use a cache size of 100 entries, occupying 5200 bytes, i.e. one extra
> memory page. The additional memory use is negligable. As well as hostnames,
> it also caches successful DNS queries which result in no data.
> 
> Simulations based on accesses to our site (which does not have many in-line
> images) show a hit rate of 90%, i.e. a reduction in name-lookups of a factor
> of 10.

This may or may not be atypical; 100 entries took me to about 70% on a 
typical sunsite trace , which suprised me. 210 entries got me to the 90% 
mark. If you're using pipes, though, you might as well cheat and use a 
local caching named; UDP is quite fast to localhost, and if you move to 
persistent processes, you can just set up a TCP connection and keep it 
buzzing.

Simon