Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Mar 1999 19:52:33 -0500 
From:      Christopher Sedore <cmsedore@maxwell.syr.edu>
To:        "'freebsd-net@freebsd.org'" <freebsd-net@freebsd.org>
Subject:   IP source address based load balancing
Message-ID:  <262C3DA9BE0CD211971700A0C9B413A1CBC7@exchange.maxwell.syr.edu>

next in thread | raw e-mail | index | archive | help

At Jordan's suggestion, I'm posting this on this list.  I just
subscribed, but have not yet received confirmation on my subscription,
so please be sure to CC: me on anything I should see.

I've implemented a basic form of load balancing for IP based services.
It works by assigning the same IP address to multiple machines, having
all the machines receive the IP packets for that address but only pass
the ones from specific sources up to the stack.  The notion is that you
can split the IP address space up (I use a mask and a comparison value)
to distribute load across servers.  My experiments have been in using
the least significant bit in the 4th octet in an IP address (ie whether
the 4th octet is odd or even).  I don't have many high-load things here,
so my testing doesn't say too much about performance.  You can use any
bit or bits that make sense to distribute load.

I hope to go further and add redundancy through this methodology by
writing a daemon to monitor the cluster and reconfigure to achieve
failover.

This was done with some relatively simple mods to the IP input, ARP, and
ioctl routines; as well as some modification to the in_aliasreq and
ifaliasreq structures.  My testing has been limited thus far, but I'd be
interested in learning whether or not there is interest in the code, and
if so, finding someone else to look over the code, as well as try it out
for themselves.  The kernel code is pretty clean, but the userland
interface is fairly simplistic.  The kernel code might need some
stylistic adjustment and some optimization, and could be extended quite
a bit to include a better selection algorithm, port based service
distribution, etc.  Ideally, ifconfig would be extended to deal with
some of the options, but I almost fainted when I examined the ifconfig
source--I wrote a simple 20 line C program to do the config instead.

The code mods are against 3.1-Release, but I'd guess that the patches
would apply fairly easily to any 3.0 or later system.  I believe that
I've located an odd behavior and a bug (I don't think that the de driver
supports if_allmulti correctly--I've tried fixing it without much
success as yet).  In any case, the code does appear to work fine with
fxp and ep drivers (the only other two I have here).

You can try telneting to 128.230.143.88 from an odd-4th-octet address
and an even-4th-octet address and see what you get.  Notice the host
banners.

-Chris


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?262C3DA9BE0CD211971700A0C9B413A1CBC7>