Mailing List Archive

[mod_backhand-users] Troubles getting backhand to work...
Hi all, I was just attempting to setup and play with backhand as I just
found out about this today; It's quite possible (hopefully) I am just
missing something really easy here, but from what I understand, I have it
setup right.

I have two machines:

rotting.deadmime.com (24.156.229.190) - 400 mhz, 128 megs memory (In
Toronto, ON)
FreeBSD 4.2 Apache/1.3.14 (Unix) Resin/1.2.1 PHP/4.0.4
balanced_by_mod_backhand/1.1.0

and

bloody.deadmime.com (24.113.62.181) - 100 mhz, 64 megs memroy (In Vancouver,
BC)
FreeBSD 4.1 Apache/1.3.14 (Unix) balanced_by_mod_backhand/1.1.0

(both machines are nat gateway machines with 2 interfaces, I dont know if
that might be causing problems)

Apache comes up on both machines fine :

Rotting ->
[Tue Dec 26 00:48:51 2000] [notice] mod_backhand -- UnixSocketDir set to
/usr/local/apache_1.3.14/backhand
[Tue Dec 26 00:48:51 2000] [notice] mod_backhand -- Broadcast
24.156.229.190:4445 added
[Tue Dec 26 00:48:51 2000] [notice] mod_backhand -- Multicast accept
24.113.62.181/1
[Tue Dec 26 00:48:51 2000] [notice] backhand_init(11351) spawning stats
things (PID 11944)
[Tue Dec 26 00:48:51 2000] [notice] Apache/1.3.14 (Unix) Resin/1.2.1
PHP/4.0.4 balanced_by_mod_backhand/1.1.0 configured -- resuming

Bloody ->
[Mon Dec 25 21:49:45 2000] [notice] mod_backhand -- UnixSocketDir set to
/usr/local/apache_1.3.14/backhand
[Mon Dec 25 21:49:45 2000] [notice] mod_backhand -- Broadcast
24.113.62.181:4445 added
[Mon Dec 25 21:49:45 2000] [notice] mod_backhand -- Multicast accept
24.156.229.190/1
[Mon Dec 25 21:49:45 2000] [notice] backhand_init(55590) spawning stats
things (PID 55940)
[Mon Dec 25 21:49:45 2000] [notice] Apache/1.3.14 (Unix)
balanced_by_mod_backhand/1.1.0 configured -- resuming normal operations

I have not added any <Directory> directives yet, but when I go to the status
pages,

http://rotting.deadmime.com/backhand/
http://bloody.deadmime.com/backhand/

I only see the local machine, from what I understand, even without anything
else, I should at least be able to see other machines
in the cluster. (I may be wrong though)

My httpd.conf file file entry for rotting and bloody (respectively) are

-- snip --
UnixSocketDir /usr/local/apache_1.3.14/backhand
MulticastStats 24.156.229.190:4445
AcceptStats 24.113.62.181

<Location "/backhand/">
SetHandler backhand-handler
</Location>
-- snip --

-- snip --
UnixSocketDir /usr/local/apache_1.3.14/backhand
MulticastStats 24.113.62.181:4445
AcceptStats 24.156.229.190

<Location "/backhand/">
SetHandler backhand-handler
</Location>
-- snip --

Any information anyone can give me on what I might be doing wrong would be
great,

Thanks!

Mike
mike@deadmime.com
[mod_backhand-users] Troubles getting backhand to work... [ In reply to ]
Mike,
Hmm.. mod_backhand sends either broadcast packets or multicast packets. The
addresses you provided in your httpd.conf are normal IPs and not broadcast
addresses. So, they are being tagged as broadcast packets by mod_backhand.
Make sure that your routers will allow broadcast through. Of course, you
probably don't want to let them through from just anywhere or you may expose
your self to a smurf of fraggle attack.

You could alo use IP multicast if you have an enabled path between you
computers.

Also, you probably want to augment your AcceptStats lines. and add multicast
stats lines (you can have more than one)

So, lets assume that your two machines are on /25 networks (128 IPs.) If
you can get broadcast working they should both read:

MulticastStats 24.156.229.255:4445
MulticastStats 24.113.62.255:4445
AcceptStats 24.156.229.128/25
AcceptStats 24.113.62.128/25

Or, if you really only want those two machines to play the game (and never be
able to semlessly bring up other machines on those subnets:

MulticastStats 24.156.229.190:4445
MulticastStats 24.113.62.181:4445
AcceptStats 24.156.229.190/32
AcceptStats 24.113.62.181/32

I recommend the first one as most routers are more comfortable passing
boradcast UDP packets to IP broadcast addresses. Note: you have to enable
"directed broadcast," so check your routers...

Of course, if you can use IP multicast, that would be much cooler. If you
don't run the routers in between, I would wager multicast routing is
disabled. Assuming both machines are connected to the same provider (like
UUNET) you may be able to fix this with a phone call. Explain that some of
your applications require IP multicast support between your two subnets. This
coul dbe useful for teleconferencing software too :-)

Mike wrote:
> Hi all, I was just attempting to setup and play with backhand as I just
> found out about this today; It's quite possible (hopefully) I am just
> missing something really easy here, but from what I understand, I have it
> setup right.
>
> -- snip --
> UnixSocketDir /usr/local/apache_1.3.14/backhand
> MulticastStats 24.156.229.190:4445
> AcceptStats 24.113.62.181
> -- snip --
> UnixSocketDir /usr/local/apache_1.3.14/backhand
> MulticastStats 24.113.62.181:4445
> AcceptStats 24.156.229.190
>

--
Theo Schlossnagle
1024D/A8EBCF8F/13BD 8C08 6BE2 629A 527E 2DC2 72C2 AD05 A8EB CF8F
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
[mod_backhand-users] Troubles getting backhand to work... [ In reply to ]
Heh, well you figured it out for me, I simply did not put *both machines in
each httpd.conf file; once
I put them both in, it saw them all right away, and it works great!!!

which, unfortunatly, spawns more questions... :)

1) Can you give a perticular machine a weight? basically what I want to do
with them, is
have one machine in front that proxies requests back to machines behind,
which will all
have dummy ips (10.0.0.x). I don't actually want the machine in front to
handle requests, just
to proxy them. So, is there some way to set the weight of the front machine
higher than all
the rest, thus taking it out of the pool??

2) How does mod_backhand handle sessions? ie, if I open a say PHP session ,
the request
get proxied to the machine 10.0.0.10. The next request I make (still in the
same session), gets
proxied to the machines 10.0.0.20. Will this work at all? does the session
itself actually
remain on the front machine?

Thanks!

Mike
mike@deadmime.com


> Mike,
> Hmm.. mod_backhand sends either broadcast packets or multicast packets.
The
> addresses you provided in your httpd.conf are normal IPs and not broadcast
> addresses. So, they are being tagged as broadcast packets by
mod_backhand.
> Make sure that your routers will allow broadcast through. Of course, you
> probably don't want to let them through from just anywhere or you may
expose
> your self to a smurf of fraggle attack.
>
> You could alo use IP multicast if you have an enabled path between you
> computers.
>
> Also, you probably want to augment your AcceptStats lines. and add
multicast
> stats lines (you can have more than one)
>
> So, lets assume that your two machines are on /25 networks (128 IPs.)
If
> you can get broadcast working they should both read:
>
> MulticastStats 24.156.229.255:4445
> MulticastStats 24.113.62.255:4445
> AcceptStats 24.156.229.128/25
> AcceptStats 24.113.62.128/25
>
> Or, if you really only want those two machines to play the game (and never
be
> able to semlessly bring up other machines on those subnets:
>
> MulticastStats 24.156.229.190:4445
> MulticastStats 24.113.62.181:4445
> AcceptStats 24.156.229.190/32
> AcceptStats 24.113.62.181/32
>
> I recommend the first one as most routers are more comfortable passing
> boradcast UDP packets to IP broadcast addresses. Note: you have to enable
> "directed broadcast," so check your routers...
>
> Of course, if you can use IP multicast, that would be much cooler. If you
> don't run the routers in between, I would wager multicast routing is
> disabled. Assuming both machines are connected to the same provider (like
> UUNET) you may be able to fix this with a phone call. Explain that some
of
> your applications require IP multicast support between your two subnets.
This
> coul dbe useful for teleconferencing software too :-)
>
> Mike wrote:
> > Hi all, I was just attempting to setup and play with backhand as I just
> > found out about this today; It's quite possible (hopefully) I am just
> > missing something really easy here, but from what I understand, I have
it
> > setup right.
> >
> > -- snip --
> > UnixSocketDir /usr/local/apache_1.3.14/backhand
> > MulticastStats 24.156.229.190:4445
> > AcceptStats 24.113.62.181
> > -- snip --
> > UnixSocketDir /usr/local/apache_1.3.14/backhand
> > MulticastStats 24.113.62.181:4445
> > AcceptStats 24.156.229.190
> >
>
> --
> Theo Schlossnagle
> 1024D/A8EBCF8F/13BD 8C08 6BE2 629A 527E 2DC2 72C2 AD05 A8EB CF8F
> 2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
>
[mod_backhand-users] Troubles getting backhand to work... [ In reply to ]
Mike wrote:
>
> Heh, well you figured it out for me, I simply did not put *both machines in
> each httpd.conf file; once
> I put them both in, it saw them all right away, and it works great!!!
>
> which, unfortunatly, spawns more questions... :)
>
> 1) Can you give a perticular machine a weight? basically what I want to do
> with them, is
> have one machine in front that proxies requests back to machines behind,
> which will all
> have dummy ips (10.0.0.x). I don't actually want the machine in front to
> handle requests, just
> to proxy them. So, is there some way to set the weight of the front machine
> higher than all
> the rest, thus taking it out of the pool??

Sort of...Why don't you want the machine in front to handle requests. There
are both good and bad reasons to do this. The real questions is why not have
the machine in front answer requests? It can still load balance to tha
back-end servers, but if you have it *just* proxying, you run the risk of
having the front machine with no load at all and the back machines
overloaded... Why?

On the other had, a good reason would be if you want the backend machines to
run different Apache instances that are "firewalled away from the rest of the
world, or you can't get a front end Apache instance to support your load with
all of the modules linked in that you need to serve content (like php or
perl).

To do this, name you back-end machines something differnt that your front end
machines and use the byHostname function. If you have 2 front end machines
and 10 backend machines and you name them
fe-{1,2} and be-{1,2,3,4,5,6,7,8,9,10}, then you could simply do this:

Backhand byAge
BackhandFromSO libexec/byHostname.so byHostname be
Backhand byRandom
Backhand byLogWindow
Backhand byLoad

This will (1) eliminate dead servers, (2) eliminate server that don't have
"be" in their name, (3) randomize this lisr, (4) take the first lg() of them
[.3+4 give you a random log base 2 window of your original set which help
reduce contention for the same resource], and finally (5) pick the least
loaded.

> 2) How does mod_backhand handle sessions? ie, if I open a say PHP session ,
> the request
> get proxied to the machine 10.0.0.10. The next request I make (still in the
> same session), gets
> proxied to the machines 10.0.0.20. Will this work at all? does the session
> itself actually
> remain on the front machine?

I need to put this in the FAQ. Mod_backhand doesn't handle sessions by
itself. It is easy if your application sticks session information in the URL
or in a cookie and you can determine which machine that session is activ eon
from that sessions inormation (e.g. the sessions string contains the IP
address of the server in hex).

You can write your own candidacy function called "bySession" that looks as the
URL or cookie and *if* it finds that server in its list then it will eliminate
all others. Maybe 15 lines of code... The reason this isn't included in
mod_backhand is because everyone's session info looks different.

So then, you could just say:

Backhand byAge
BackhandFromSO libexec/byCFs.so bySession # You have to write this!
Backhand byLoad

This will give you the server on which the session lives or the least loaded
server.

--
Theo Schlossnagle
1024D/A8EBCF8F/13BD 8C08 6BE2 629A 527E 2DC2 72C2 AD05 A8EB CF8F
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7