Re: [squid-users] squid accel peer load balancing weighted round robin?

From: Amos Jeffries <squid3@dont-contact.us>
Date: Wed, 7 Nov 2007 11:28:35 +1300 (NZDT)

> Hi,
>
> To sum up:
>
> * proxy squid 2.6.STABLE16
> * accelerator, squid only speak to apache2 (originserver), no other
> proxy speaking together.
> * I want to weight loadblance the squid query to the parent (origin)
> * + I want to filter the url in 2 type static and php. static
> o URL are directed to the static peer, not balanced
> o any php content URL are directed to php peer with weighted
> round-robin selection.
>
> squid behavior seems to be bugged when I put :
> cache_peer php-01 parent 80 0 no-query originserver round-robin weight=2
> login=PASS
> #cache_peer php-02 parent 80 0 no-query originserver round-robin
> weight=0 login=PASS
> cache_peer php-03 parent 80 0 no-query originserver round-robin weight=2
> login=PASS
> cache_peer php-04 parent 80 0 no-query originserver round-robin weight=1
> login=PASS
> cache_peer php-05 parent 80 0 no-query originserver round-robin weight=2
> login=PASS
> cache_peer php-06 parent 80 0 no-query originserver round-robin weight=2
> login=PASS
> cache_peer php-07 parent 80 0 no-query originserver round-robin weight=3
> login=PASS
> cache_peer php-08 parent 80 0 no-query originserver round-robin weight=2
> login=PASS
>
> weight are not respected and all the load seems to "fall" on the last
> declared peer. Note, I also declare some other peer not involved in the
> load balancing scheme.

round-robin means old fashioned Round-Robin. One query per peer, looping,
no exceptions.

weighted-round-robin means Weight Balanced Round-Robin

... and yes weighted-round-robin is only provided in Squid 3.0 or later.

> Particularly, I've re-implemented the round robin behavior via my
> redirector. And I first produced a bugged algorithm with was also
> counting the static peer in the peer rotation.

I'd advise going to squid-3.0-RC1, unless its running on windows.
We believe Squid3 is ready for release on any non-window platform, there
is just one know bug in win32 holding it in RC back from final.

>
> bugged algo, static peer selection are also counted and break the round
> robin selection.
> $n=0;
> while(<>)
> {
> if(static)
> {
> s/url/static/;
> }
> else
> {
> $peer = $all_peer[$n%nb_peer];
> }
> print;
> $n++;
> }
>
>>> I measure load by looking on some MRTG like graph of all the server
>>> pool. And clearly it see, than the load is badly divided on each peer.
>>
>> config problem.
>>
>> use "round-robin" for strictly old fashioned round-robin,
>> "weighted-round-robin" for round-robin with "weight=" load balancing
> weighted-round-robin, starts from squid3 I think.
>
>>>> CARP is purpose build load balancing algorithm, and as far as I
>>>> know, it should work with originserver.
>>>> http://docs.huihoo.com/gnu_linux/squid/html/x2398.html
>> No. It's a parent proxy/server thing.
>> "
>> use 'carp' to define a set of parents which should
>> be used as a CARP array. The requests will be
>> distributed among the parents based on the CARP load
>> balancing hash function based on their weight
>> "
>> says so twice to be sure.
>>
>> FWIW, "originserver" only affects the replies squid produces. Whether
>> it spoofs being a web server for the data requested.
> Yes, but it's some what confusing, because parent seems to name
> orginserver and hierarchical proxy.
> I've read some old post which say that the algorithm was only available
> for "parent" proxy. Which means for me that it can apply to another
> proxy not an origin server.
>
> http://www.mail-archive.com/squid-users@squid-cache.org/msg09265.html
>
> But as Amos said, it may be the same for squid.
>
> I tested the CARP config and squid complain about the conf syntax:
>
> cache_peer php-01 parent 80 0 no-query no-digest originserver login=PASS
> carp-load-factor=0.062500

carp-load-factor= was replaced by weight= in some early 2.6 release.

Amos

> cache_peer php-03 parent 80 0 no-query no-digest originserver login=PASS
> carp-load-factor=0.062500
> cache_peer php-04 parent 80 0 no-query no-digest originserver login=PASS
> carp-load-factor=0.062500
> cache_peer php-05 parent 80 0 no-query no-digest originserver login=PASS
> carp-load-factor=0.062500
> cache_peer php-06 parent 80 0 no-query no-digest originserver login=PASS
> carp-load-factor=0.062500
> cache_peer php-07 parent 80 0 no-query no-digest originserver login=PASS
> carp-load-factor=0.187500
> cache_peer php-08 parent 80 0 no-query no-digest originserver login=PASS
> carp-load-factor=0.062500
> cache_peer php-09 parent 80 0 no-query no-digest originserver login=PASS
> carp-load-factor=0.437500
>
> squid -k parse
> 2007/11/06 16:08:36| parse_peer: token='carp-load-factor=.062500'
> FATAL: Bungled squid.conf line 592: cache_peer varan-01 parent 80 0
> no-query no-digest originserver login=PASS carp-load-factor=.062500
>
> Squid Cache: Version 2.6.STABLE16
> configure options: '--prefix=/usr' '--exec_prefix=/usr'
> '--bindir=/usr/sbin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib/squid'
> '--sysconfdir=/etc/squid' '--localstatedir=/var/spool/squid'
> '--datadir=/usr/share/squid' '--enable-async-io' '--with-pthreads'
> '--enable-storeio=ufs,aufs,coss,diskd,null' '--enable-linux-netfilter'
> '--enable-arp-acl' '--enable-epoll' '--enable-removal-policies=lru,heap'
> '--enable-snmp' '--enable-delay-pools' '--enable-htcp'
> '--enable-cache-digests' '--enable-underscores' '--enable-referer-log'
> '--enable-useragent-log' '--enable-auth=basic,digest,ntlm'
> '--enable-carp' '--enable-follow-x-forwarded-for' '--with-large-files'
> '--with-maxfd=65536' 'i386-debian-linux' 'build_alias=i386-debian-linux'
> 'host_alias=i386-debian-linux' 'target_alias=i386-debian-linux'
>
> carp seems to be enabled...
>
> Regards,
> Sylvain.
>
Received on Tue Nov 06 2007 - 15:28:39 MST

This archive was generated by hypermail pre-2.1.9 : Sat Dec 01 2007 - 12:00:02 MST