Re: Does squid re-resolve hostnames named in squid.conf?

From: Michael Pelletier <mikep@dont-contact.us>
Date: Wed, 16 Sep 1998 11:54:52 -0400 (EDT)

> Bob Franklin <R.C.Franklin@reading.ac.uk> writes:

> What I'd like to know is, if they change this alias to point at
> another machine, will Squid notice and switch over? Or, does it
> only resolve the hostnames -> IP addresses on startup and we'd
> need to HUP Squid occasionally to have it re-resolve these names?

Bob, in my work developing the Squid connection-retry patch, I got
familiar with the behavior of Squid's DNS subsystem.

Basically, in order to minimize the number of DNS lookups, Squid
establishes an IP cache and stores the values returned from the
nameserver in this cache. If you look at the "IP Cache Contents"
selection of the cachemgr.cgi, you'll see what it contains.

This cache works extremely well, particularly when the
connection-retry patch is used -- the patch modifies the behaviour of
the cache so that addresses that fail to respond are kept in the cache
marked bad, instead of being dumped from the cache.

This results in a cache hit rate of upwards of 98%, meaning that my
cache serving around a hundred to a hundred and twenty thousand
objects per day can get by with three lightly utilized dnsservers --
feel free to use cachemgr.cgi to check out IP cache contents and DNS
server stats for my Squid cache at proxy.comshare.com - no password is
required for these screens - and to check out the graphs at
http://proxy.comshare.com/monitor/squid )

One issue that arises out of this is that if a host's IP address
changes, the address does not drop out of Squid's IP cache -- and thus
Squid does not attempt another DNS lookup -- until the squid.conf
"positive_dns_ttl" time expires. This defaults to 360 minutes, or six
hours. The DNS TTL value is ignored.

At the outset this was not a big deal for me, since IP addresses of
frequently-accessed sites so rarely change, and if a user started
whining about it, I'd just restart Squid.

However, I dislike doing that since I like to see the uptime numbers
climb ever higher, so once the most compact, efficient way to do it
finally dawned on me, I wrote a patch that allows you to manually
remove entries from the IP cache. It adds functionality to the PURGE
method to remove the host's entry from the IP cache when a URL
containing that hostname is purged. Thus, by simply enabling the
purge method in Squid and doing:

        client -m PURGE http://www.jpl.nasa.gov/

the IP cache entry for that host is removed, even if that specific
object does not exist in the cache and the purge returns "object not
found."

The ipcache_purge patch is located at the following URL, and applies
to 1.1.22:

        ftp://ftp.comshare.com/pub/squid/ipcache_purge.patch

Hope this helps! Let me know if you have any questions.

        -Mike Pelletier.
Received on Wed Sep 16 1998 - 08:56:12 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:42:02 MST