tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Koecke ...@schlund.de>
Subject [PATCH] for lb_worker in jk1 with local workers
Date Wed, 15 May 2002 09:09:13 GMT
Hi,

here is the patch for lb_worker in jk1. I tested it on a testcluster and it 
worked for me.

It adds two config params:
'local_worker_only' on the lb_worker
'local_worker' on the balanced workers, e.g. an ajp13 worker

Example environment:
A cluster with two nodes (TC1+TC2), running apache+tomcat tandem on each node, a 
loadbalancer in front of the nodes.

Example conf of TC1:

workers.tomcat_home=<tomcat-home-dir>
workers.java_home=$(JAVA_HOME)
ps=/
worker.list=router

worker.TC1.port=8009
worker.TC1.host=node1.domain.tld
worker.TC1.type=ajp13
worker.TC1.lbfactor=1
worker.TC1.local_worker=1

worker.TC2.port=8009
worker.TC2.host=node2.domain.tld
worker.TC2.type=ajp13
worker.TC2.lbfactor=1
worker.TC2.local_worker=0

worker.router.type=lb
worker.router.balanced_workers=TC1,TC2
worker.router.local_worker_only=1

The 'local_worker' flag on TC1 and TC2 tells the lb_worker which connections are 
going to the local worker. If local_worker is an int and is not 0 it is set to 
JK_TRUE and marked as local worker, JK_FALSE otherwise. If in minimum one worker 
is marked as local worker, lb_worker is in local worker mode. All local worker 
are moved to the beginning of the internal worker list in lb_worker during 
validation.

This means that if a request with a session id comes in it would be routed to 
the appropriate worker. If this worker is down it will be send to the first 
local worker which is not in error state.

If a request without a session comes in, it would be routed to the first local 
worker. If all local worker are in error state, then the 'local_worker_only' 
flag is important. If it was set to an int and this wasn't 0 it is set to 
JK_TRUE, JK_FALSE otherwise. With set to JK_TRUE, this request gets an error 
response. If set to JK_FALSE lb_worker tries to route the request to another 
balanced worker.

If one of the worker was in error state and has recovered nothing changes. The 
local worker will be check for requests without a session id (and with a session 
on himself) and the other worker will only be checked if a request with a 
session id of this worker comes in.

In this environment, with a load balancer in front, it is an error if the 
balancer sends a request without a session to an apache without a running local 
worker. And if the looad balancer determines that a node is down no other node 
is allowed to send a request without a session to it. This is necessary for me, 
because on a switched off node apache and tomcat can still be up and running, 
but they are in an old state and should only be asked for old sessions.

Defaults:
local_worker: 0
local_worker_only:0

Internals:
The local workers are at the binning of the worker list. Additionaly I don't 
change the lb_value for local workers, but because of the workers order this 
should not be necessary.

I didn't changed the name of the local_worker_only flag because it suits the 
name with local_worker. But the flags are defines in jk_util.c its easy to 
change them.

I hope its usefull, the patch was geenrated against cvs with diff -u.

Bernd
-- 
Dipl.-Inform. Bernd Koecke
UNIX-Entwicklung
Schlund+Partner AG
Fon: +49-721-91374-0
E-Mail: bk@schlund.de

Mime
View raw message