Re: [squid-users] squid and loadbalancing option

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Tue, 11 Nov 2008 03:28:28 +1300

Martin Mulder wrote:
> 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:

* name= is a unique identifier. It cannot be used twice.

>
> ## 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?
>

Not the way you are trying.

Assuming that the use of cookies means the visitors need to always
request from the same origin.

I think the simpler approach you need is to have Squid as front-end
accelerator using sourcehash to load balance over the real origin servers.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE5 or 3.0.STABLE10
   Current Beta Squid 3.1.0.2
Received on Mon Nov 10 2008 - 14:28:53 MST

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