[squid-users] How to "active" update NetDB informations ?

Alex Rousskov rousskov at measurement-factory.com
Fri Jul 1 17:00:30 UTC 2022


On 7/1/22 10:22, Théo BARRAGUE wrote:

> I'm facing to issue with squid : i want to use squid to route http 
> traffic though the fastest path ( based on RTT ).
> 
> Before to explain my problem, this is my configuration where :
> 
>   * *client* is a http client : curl, wget, firefox, ...
>   * *squid* is a squid instance with /never_direct allow all/ option to
>     prevent direct access but with *squid a* and *squid b* as parents
>     peers and /query_icmp/ /on/ option
>   * *squid a* and *squid b* are squid instances that can make direct
>     connections
>   * all *squid *instances are cacheless and built with /--enable-icmp/
> 
> Now, come issues. When *squid* send a request to *squid a* or *squid b*, 
> two ICP packets are sent ( to *squid a* and *squid b* ) and the squid 
> which do the direct connection send an icmp to origin server and squid 
> instances update their netdb informations ( *squid a* or *squid b* 
> "locally" from icmp answer and *squid* though ICP ).

Correct.


> If *link a* slows down, the RTT will increase and *squid* will send all 
> requests to *squid b* because his RTT is low.

Yes (by default).


> But, if *link a* come back and with a lower RTT than *squid b*, *squid 
> a* will never know because no requests are made to him until RTT on 
> *squid b* goes up ( upper than the "uppest" / "oldest" RTT of *squid a* ).

Yes, if Squid A has no reason to go to a site, it will not update its 
ICMP RTT information for that site. Squid does not probe origin sites 
unless it needs to send a request to that site.


> How to deal with this scenario ?

Interesting question! AFAICT, you have several options to keep RTT 
information fresh, including:

* Force some client traffic through the slower path. See 
weighted-round-robin in squid.conf.documented. This will make your 
clients suffer for the sake of keeping NetDB fresh.

* Modify Squid sources so that a parent that receives an ICP query sends 
an ICMP request to the corresponding origin server (if the available 
NetDB information became stale). This requires development and will 
double ICMP traffic from your Squid farm (because each parent will send 
an ICMP request for every HTTP transaction for a site that needs a NetDB 
record update).

* Enable active background "probing" of (popular?) sites through each 
parent. This will increase both ICMP and HTTP traffic from your Squid farm.

Pick your poison...

I know that you called the last solution a "workaround rather than a 
good solution" but I do not know what you are trying to optimize, so I 
cannot agree or disagree with that judgement.


> I can also restart squid a and squid b every 5 minutes for example to
> flush netdb informations

I agree -- erasing fresh RTT information (in an actively used peer that 
has fresh NetDB) is not a good solution. If you go this route, then you 
may also need to disable the disk copy of NetDB ("netdb_filename none").


HTH,

Alex.


More information about the squid-users mailing list