[squid-users] affinity session load balancing

Amos Jeffries squid3 at treenet.co.nz
Wed Nov 18 06:47:07 UTC 2015


On 17/11/2015 12:48 a.m., Antony Stone wrote:
> On Monday 16 November 2015 at 12:17:49, Patrick Chemla wrote:
> 
>> Hi,
>>
>> This is exactly the problem.
>>
>> When users connect to the application, they go through the squid, then
>> reach a login page where they enter login/passwd.
>>
>> The application creates cookies including a PHPSESSION cookie.
>>
>> Can squid use such cookie?
> 
> I do not believe Squid can do session-affinity load balancing based on cookies 
> (but I'm happy to be corrected by anyone who knows better).
> 

Sort of. Squid does not touch Cookies and cannot do this with just a
config option toggle.

If the application were doing *real* HTTP authentication then Squid
would have access to the user name/label to perform userhash load
balancing. Sadly it is only pretending.


Squid also does not do sessions itself. The criteria for defining "a
session" is just too fuzzy.

But with an external ACL helper it can perform 'sticky' cache_peer
selection.

All you need do is to write a helper that takes in the Cookie header
value (all of it). Identifies what the "session" is (if any) according
to your criteria. Then emits a tag= token to Squid (one unique token
value for each cache_peer). That gets used in http_access.
The cache_peer_access then uses a tag/note ACL to select which peer(s)
that request is allowed to go to.

Amos



More information about the squid-users mailing list