[squid-users] What's the algorithm to achieve AclRandom

Alex Rousskov rousskov at measurement-factory.com
Sun Sep 18 14:59:10 UTC 2016


On 09/18/2016 05:41 AM, yanghe wrote:

> I have two ICAP servers and want load balancing.If I
> use AclRandom,the traffic will be averagely distributed to
> the two ICAP servers,but it can't guarantee the integrity of
> the session.For example,I sent a message with 5
> attachments,which were randomly assigned to two ICAP servers.

>From Squid point of view, the "session" you are talking about does not
exist and, hence, there is no "integrity of the session" issue.


>                 If I want the 5 attachments to go to only one ICAP to
>             maintain the integrity of the session and load banlacing as
>             far as possible,which parameters can be used.

HTTP itself does not tie an "attachment" transaction to the "parent"
transaction to form what you call a "session". Each HTTP
request/response pair are independent from other pairs. You are thinking
in application terms that Squid/HTTP does not understand/support.

Going forward, you have two basic options:

A. Define "session" in HTTP or Squid terms that Squid understands. Write
ACLs (likely including an external ACL or an eCAP adapter) that will
define a "session" for any given transaction and annotate same-session
transactions accordingly. Load balance based on sessions instead of
random events. The same external ACL or eCAP adapter can define load
balancing by annotating the transaction according to the ICAP service it
should be directed to.

B. Adjust the ICAP service to store information about "sessions" in such
a way that different service instances can share it. For example, if all
ICAP services run on the same machine, they can use shared memory
segments to exchange information among each other.


HTH,

Alex.



More information about the squid-users mailing list