[squid-users] squid and loadbalancing option

From: Martin Mulder <martin.mulder_at_dia.groningen.nl>
Date: Mon, 10 Nov 2008 13:00:21 +0100

Hi,

I have (maybee a stupid) question.
I have an apache server as reverse proxy, squid as caching server and
Zope/Plone as backend servers.

Senario:

1) Apache gets a request for my.domain.com
2) Apache does a ProxyPass to my balancer
3) I have 2 "sticky" vhosts in apache which are the balancer members.
These are not reachable from the outside, and are called sticky1 and
sticky2.
These "sticky" vhost creates a cookie, which is uses by the balancer,
to decide the sticky server.
these sticky vhost forwards the request to Squid.

4) Squid is running @ 127.0.0.1:3389 and 127.0.0.2:3389
5) Sticky1 vhost proxies a request to http://sticky1.domain.com:3389,
sticky2 vhost proxies a request to http://sticky2.domain.com:3389
( where sticky1.domain.com resolves to 127.0.0.1 and sticky2.domain.com
resolves to 127.0.0.2 )

At the moment I have the following configuration:
## Backend server 1
cache_peer 192.168.2.3 parent 8100 0 no-query originserver
name=server1
cache_peer_domain server1 sticky1.domain.com

## Backend server 2
cache_peer 192.168.2.4 parent 8100 0 no-query originserver
name=server2
cache_peer_domain server2 sticky2.domain.com

This results in:

a webrequest comes to apache ( without an host-cookie ) on
my.domain.com
the request will be proxied to a balancermember ( based on the
balancing policy )
this vhost creates a cookie ( like: BALANCEID: balancer.sticky1 or
BALANCEID: balancer.sticky2 )
the vhosts proxied the request to http://sticky1.domain.com:3389 or
http://sticky2.domain.com:3389

-- The request reaches squid --

the request comes to the cache_peer depending on the domain ( sticky1
of sticky2 )
squid delivers the page ( or from cache, or from originserver )

In this case squid can deliver a 500 or 503 if the requested backend
server is down.
So if my request has a cookie for sticky1.domain.com and 192.168.2.3
originserver is down, the users with this cookie get an error.
So if my request has a cookie for sticky2.domain.com and 192.168.2.4
originserver is down, the users with this cookie get an error.

What I try, but can't get working:

every cache_peer_domain has 2 cache_peers:

## Backend server 1
cache_peer 192.168.2.3 parent 8100 0 no-query originserver
name=server1
cache_peer 192.168.2.4 parent 8100 0 no-query originserver name=server2
// This server doesn't have the session information
cache_peer_domain server1 sticky1.domain.com

## Backend server 2
cache_peer 192.168.2.4 parent 8100 0 no-query originserver
name=server2
cache_peer 192.168.2.3 parent 8100 0 no-query originserver name=server1
// This server doesn't have the session information
cache_peer_domain server2 sticky2.domain.com

But the cache peer which hasn't the session may only be used it the
other cache_peer is down.

is the possible with squid 2.6?
Received on Mon Nov 10 2008 - 12:01:00 MST

This archive was generated by hypermail 2.2.0 : Mon Nov 10 2008 - 12:00:03 MST