[squid-users] cache_peer selection
Alex Rousskov
rousskov at measurement-factory.com
Fri May 12 14:53:03 UTC 2023
On 5/12/23 07:28, Alexeyяр Gruzdov wrote:
> Hello Guys!
>
> Thank you for your help that was before!
>
> Could you explain somethings - For example I have a five cache_peer servers
>
> peer1
> peer2
> peer3
> peer4
>
>
> And users like:
>
> User-100
> User-101
>
> For forwarding requests over existed cache_peer I use an external ACL
> and "note" option - all works well.
>
> Now I'd like to implement the next logic:
> This is something like a failover of specified cache_peers for specified
> user.
If your external ACL can tell whether the peer has "failed", then the
external ACL can annotate the transaction not to use that failed peer.
Otherwise, what you want may be possible using complex ACL tricks, but I
am not sure, and do not have the time to explain/test those tricks. In
short, you would need to create ACLs that detect peer selection stage[1]
and select a different peer during different stages.
[1] https://wiki.squid-cache.org/Features/LoadBalance#go-through-a-peer
FWIW, dynamic peer selection with failover preference support is a known
missing feature. Factory has implemented that feature[2], but we need
more time to polish and submit our implementation for the official Squid
Project consideration. With that feature, there is no need for the
complex ACLs mentioned above because the ACL script simply tells Squid
which peers to use for the transaction, in which failover order.
[2] https://github.com/measurement-factory/squid/pull/169
> For example:
> We send User-100 over peer1, if peer1 is failed - that User-100 must to
> go over peer2.
Without code modifications, the above example will work because Squid
will prefer peer1 to peer2, assuming that, in squid.conf, the cache_peer
directive for peer1 is listed higher/earlier than that for peer2.
> For User-101 - something like - primary will be peer4, if its failed
> User-101 must to go over peer3.
However, this example will _not_ work by default, for the same reason:
When both peers are alive, Squid will prefer peer3 over peer4.
HTH,
Alex.
> its something like primary and multiple of backup of cache_peer
>
> etc....
>
>
> Thank you !
>
> Alexg
>
>
>
>
>
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-users
More information about the squid-users
mailing list