[squid-users] Groups of peers load-balancing
Amos Jeffries
squid3 at treenet.co.nz
Thu Oct 6 10:11:27 UTC 2016
On 6/10/2016 8:52 p.m., George William Herbert wrote:
> Usually you load balance with another tool...
HTTP Load Balancer is one of the roles Squid is designed for.
When you need to converge the LB, routing, and caching tasks Squid is
the product for the job.
>
>> On Oct 6, 2016, at 12:16 AM, Patrick Chemla wrote:
>>
>> Hi,
>>
>> I am using Squid Cache: Version 3.5.20 on 2 Fedora 24 server.
>>
>> I have to set a load-balancer for multiple sites, each using
>> different peers, on both servers + cloud instances.
>>
>> Squid is the entry point for all websites. According to the domain,
>> I will have 2 to 5 peers to handle the load. But, as I have 2 big
>> domains, and a group of other domains, I need dedicated peers for
>> each big domains, and another groups of peers for other domains.
>>
>> So squid must route requests :
>>
>> - for domain A to peers A1 A2 A3
>>
>> - for domain B to peers B1 B2 B3 B4 B5
>>
>> - for all other domains to peers O1 O2
>>
>> Load balancing method within a group could be different, as some
>> domains need user to reach always same peer, when other domain
>> could simply handle round-robin balancing.
>>
>> I can't find how to group peers A1 A2 A3 to group A, peers B1
>> B2..B5 to group B, O1 O2 to group O, then set the cache_peer_access
>> to the needed group.
Grouping is done by cache_peer_access ACLs.
You need to define one ACL which will only match for one group.
Typically the domain name is used for that. The "group" is simply the
peers which the request is allowed to be sent to.
For example:
acl groupA dstdomain .example.com
acl groupB dstdomain .example.net
acl groupO dstdomain .example.org
cache_peer_access A1 allow groupA
cache_peer_access A1 deny all
cache_peer_access A2 allow groupA
cache_peer_access A2 deny all
...
cache_peer_access B1 allow groupB
cache_peer_access B1 deny all
cache_peer_access B2 allow groupB
cache_peer_access B2 deny all
...
Since your peers are split into distinct groups just add the relevant
algorithm to the cache_peer in that group which is using it.
Things can get complex if you have one peer being part of two groups.
But then you just define two cache_peer lines for it, one in each group
with the relevant LB algorithm. The name= parameter is used distinguish
which cache_peer line is relevant for the cache_peer_access rules.
Amos
More information about the squid-users
mailing list