tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Frieden <>
Subject [PATCH] jk_lb_worker patch
Date Mon, 07 May 2001 21:32:36 GMT
Attached is a patch for the lb worker for mod_jk.  Basically, it changes
the selection behavior slightly and adds some error and debugging
logging where we would find it useful.

The code uses two variables, lb_factor, and lb_value.  lb_factor is the
numerical inverse (1/x) of what is entered into the
file.  This causes the lb_factor to become very large if the lb_factor
in is 0.  lb_value always starts at 0.

The decision of which worker is used is based on lb_value.  The worker
with the lowest lb_value gets selected to service a request.  After a
worker is used, its lb_value is incremented by lb_factor. 
Unfortunately, this causes the balancer to service at least one request
on each worker before the lb_factor actually has any effect.  This one
request will often lead to an entire session being served off of a
different worker.

This behavior isn't really a problem, but in a scenario where you have
an external load balancer, it is preferable to try to honor its
decisions except where there is an error.  Such an error can happen with
providers that use IP randomizing proxies such as AOL.  Its also nice to
be more deterministic in the normal case.

This patch seeds the lb_value with 1/lb_factor.  This changes the
behavior by causing lb_value to be larger for servers with lower weights
than servers with higher weights.  If the lb_factor in is 0, it becomes very large and should only be
selected in the case of all the regular workers being unavailable or due
to a session route.

I added error logging for if the worker specified by the session route
is unavailable.  I added debug logging for selecting a worker by session
route, and for which worker is selected.

This hasn't been tested much, but its almost a trivial change.  This is
against 3.2.1, but it should apply clean to later versions as well. 
Feedback is welcome.

View raw message