Re: [squid-users] dns-related cache problem (squid 3.3.8)

From: Eliezer Croitoru <eliezer_at_ngtech.co.il>
Date: Wed, 09 Oct 2013 22:23:02 +0300

Hey,

In the old days of hosts this one the only option.
if you are really into this thing you can use a resolver for this task.
If you will start a DNS resolver that sits on the let say localhost and
has the option to lookup another services you can use this resolver to
do the same thing.
I would say that touching the hosts file very frequent by itself can be
a bad idea.
If you need to load the hosts file try a reload.
Then try to see how often the hosts file is being changed..
I would have tried BIND as a dns cache service and would add a forward
zone into a local resolver that would affect only a specific subdomain.

I think that youtube mapping in the hosts files inside squid is kind of
odd..
Squid has the capability to use a cache_peer with ICP or HTCP..
(ICP and HTCP helpers or modules for nginx\apache\goahead\lighthttp etc
are welcome but just don't forget to erase some files since the max in
one Subdirectory in extX is 65k..

Best Regards,
Eliezer

On 10/09/2013 07:42 AM, Amos Jeffries wrote:
> On 9/10/2013 9:39 a.m., Dash Four wrote:
>> I have the following problem: I use the "hosts" file to store static
>> address mappings, usually containing sites which use geo address
>> mapping (in other words, determine the ip address one is going to use
>> depending on the geographic region the request is made from). One such
>> site is youtube for example.
>>
>> Squid caches web pages content from these sites, but when I change the
>> IP address in "hosts", squid is still using the old IP address for
>> some reason, even though I verified that the new mapping is used by
>> the system.
>>
>> In such cases, I have to stop squid, wipe out the entire cache and
>> then restart squid in order for the new host->ip mapping to be used.
>> This can't be right!
>>
>> What I presume is happening is that somewhere along the line, squid is
>> storing clear ip addresses in the cache (probably to speed up serving
>> page content requests) and then it does not check whether that ip
>> address has changed. If that is so, could this be fixed, because the
>> idea of me clearing the entire cache every time I change one of the
>> "hosts" mappings does not exactly appeal to me. Thanks.
>
> Sort of. Squid loads the hosts file contents into DNS result cache with
> an infinite TTL in order to provide a single lookup mechanism for any
> DNS entry and prevent remote lokups of those FQDN. These are only loaded
> on startup and reconfigure time.
>
> Squid at this time does not yet have any mechanism for watching the file
> for changes (patches welcome!).
> If your OS supports a filesystem trigger feature such as inotify or
> dnotify you can script up a restart of Squid when hosts changes.
>
> Amos
Received on Wed Oct 09 2013 - 19:23:14 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 10 2013 - 12:00:05 MDT