Re: [SQU] Load balance several Internet links using one cache

From: Joe Cooper <>
Date: Fri, 02 Mar 2001 04:41:05 -0600

This has been discussed a few times recently. I think where you really
need to be looking is to routing configuration, not Squid. Squid can
balance among multiple parent caches...and it is probably not overly
difficult to add a round robin style link balance option without needing
parents above, if you're willing to do some programming. But with
proper routing configuration, you can balance all of your traffic across
   multiple interfaces, not just web traffic.

If using Linux, the Advanced Routing HOWTO can provide some good
information for you. (And if you are a big network, i.e. you have your
own AS, you probably can convince your upstreams to allow you to use BGP
for balancing across your links. In which case Zebra will be your best runs on Linux and most other Unices.)

None of this is really about Squid, however...Unless someone plans to
add balancing between links to Squid. (I don't think it is generally a
worthy area of development, myself...because we use Linux and Linux has
everything we need to do it at the packet level (as does FreeBSD, among
others in differing implementations). So why waste CPU thinking about
it at the URL level?) If you really wanted to do it with Squid, I
suppose you could set up four Squids. One for each interface, and a
client side Squid to balance among the the three parents. I've never
even thought much about such a configuration, but I imagine one could
even do this on one box with each Squid sitting on a different port and
none but the client side proxy having much object storage. This is
probably insanely complicated for what you want to do and crazily
resource hungry...but it would do it all with Squid.

I seem to recall that I made some routing configuration suggestions here
about 2 months ago for how to do this with Linux. But it may have been
on another list. If a search of the list archives turns up nothing let
me know and I'll see if I can't dig up my notes on this sort of thing
and give you a summary. (Reading the Advance Routing HOWTO is your
first task, though. As the author of that doc knows a lot more about
routing under Linux than I do.) But, in short, you simply divide up the
internet into subnets based on the last octet ( and route a
third (or whatever fraction) of that space to each interface. It's
easiest to divide it up by twos, and can then be done with only 2 or 4
or 8 rules depending on the number of interfaces you have. But even
with an odd number of interfaces, dividing it up can be done in 255
rules of less. ;-)

Also, I should point out, with the new 2.4 routing code, it is probably
possible to create (maybe already exists?) a userspace tool to hash the
IP and route based on the result, thus providing a much more even
distribution across the interfaces. It could even, technically, provide
balancing based on the current load of each interface, choosing one that
is least loaded at any time. (I do not think such a thing currently
exists, but if it does, I'd love to hear about it.)

Another document worth looking at is here:

As it covers some of the gritty details I am not totally qualified to
explain (like fwmarks, and routing based on those marks).

Hope this helps.

Operation squid list wrote:

> Dear Squid Users,
> Is there a way squid can load balance incomming (downloaded) traffic
> from the web servers to it, on a several links ?
> This is needed very much in case if there is 3 links connected to my
> and these links are with different bandwidths, how can I make squid
> download from these 3 links and load balance between them
> I figured if I can set several IP's for the squid, and squid can load
balance outgoing requests to web servers on these IP's it will be
> done.
> if Linux or Unix must have only 1 gateway only, then IP spoofing should
> be used, where squid will send requests to the web servers through
> it's only 1 gateway, but spoof the IP address of the source to be
> a round robin from the IPs on the squid engine. or can it be done
> using several interfaces?
> Any help or suggestions about this? I think it is a good idea for load
> balancing that maybe many of squid users may find effective.
> Best Regards Sherif

                       Joe Cooper <>
                   Affordable Web Caching Proxy Appliances

To unsubscribe, see
Received on Fri Mar 02 2001 - 03:37:42 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:58:28 MST