Bill Burke wrote:
> I'll be your buddy
OK Bud!
I've just checked in a skeleton load balancer into
Jetty/src1.4/org/mortbay/loadbalancer
It has all the nio network plumbing for two way connections with
flow control - but not very good exception handling at the moment.
A trivial round robin policy is used:
public class Policy
{
private Server[] _server;
private int next;
public Policy(Server[] server)
{
_server=server;
}
public void allocate(Connection connection)
throws IOException
{
next=(next+1)%_server.length;
connection.allocate(_server[next]);
}
}
Note that this Policy class does not even have the API to do
anything real.... can't look for jsessionid and fiddly to get the
InetAddress of the client.... but it is at least a start.
The nio stuff is really rather cool - I think I may take some
timeout from load balancing to write SocketChannelListener for
Jetty, which should be a big winner for scalability!!!
So Bill or other Buddies, please have a look at the code and we
can talk Policies soon!
I use the org.mortbay.tools.Tenlet (telnet backwards) class
as a sample server - so I can type back at a telnet client.
to run with 1 listener on 8123 and two servers you say:
java org.mortbay.loadbalancer.Balancer :8123 - 127.0.0.1:8888 127.0.0.1:9999
remember this is a release-early-release-often piece of code... be gentle :-)
cheers
PS. If another buddy wants to get in on the scene - we have to make the
thing JMX manageable!
cheers
--
Greg Wilkins<[EMAIL PROTECTED]> GB Phone: +44-(0)7092063462
Mort Bay Consulting Australia and UK. Mbl Phone: +61-(0)4 17786631
http://www.mortbay.com AU Phone: +61-(0)2 98107029
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development