Author: rjung
Date: Fri Sep 23 00:46:55 2011
New Revision: 1174468
URL: http://svn.apache.org/viewvc?rev=1174468&view=rev
Log:
When using the alternate decay for the "Next"
session lb method, calculate curmin only for
active workers. Otherwise curmin will quickly
stabilize at "0".
Decay non-active workers as well so that they
do not report fantasy values.
Modified:
tomcat/jk/trunk/native/common/jk_lb_worker.c
Modified: tomcat/jk/trunk/native/common/jk_lb_worker.c
URL:
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.c?rev=1174468&r1=1174467&r2=1174468&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_lb_worker.c (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.c Fri Sep 23 00:46:55 2011
@@ -624,7 +624,7 @@ static jk_uint64_t decay_load(lb_worker_
{
unsigned int i;
jk_uint64_t curmax = 0;
- jk_uint64_t curmin;
+ jk_uint64_t curmin = 0;
lb_sub_worker_t *w;
ajp_worker_t *aw;
@@ -636,9 +636,6 @@ static jk_uint64_t decay_load(lb_worker_
if (p->lbmethod != JK_LB_METHOD_NEXT) {
w->s->lb_value >>= exponent;
}
- if (w->s->lb_value < curmin) {
- curmin = w->s->lb_value;
- }
if (w->s->lb_value > curmax) {
curmax = w->s->lb_value;
}
@@ -649,7 +646,23 @@ static jk_uint64_t decay_load(lb_worker_
if (p->lbmethod == JK_LB_METHOD_NEXT) {
for (i = 0; i < p->num_of_workers; i++) {
w = &p->lb_workers[i];
- w->s->lb_value -= curmin;
+ /* Take into account only the workers that are
+ * not in error state, stopped, disabled or busy.
+ * Unfortunately we can not respect activations
+ * defined by mapping rules here.
+ */
+ if (JK_WORKER_USABLE(w->s->state, w->activation)) {
+ if (curmin == 0 || w->s->lb_value < curmin) {
+ curmin = w->s->lb_value;
+ }
+ }
+ }
+ for (i = 0; i < p->num_of_workers; i++) {
+ w = &p->lb_workers[i];
+ if (w->s->lb_value >= curmin)
+ w->s->lb_value -= curmin;
+ else
+ w->s->lb_value = 0;
}
}
JK_TRACE_EXIT(l);
@@ -752,7 +765,7 @@ static int find_best_bydomain(jk_ws_serv
strlen(wr.domain) != domain_len ||
strncmp(wr.domain, route_or_domain, domain_len))
continue;
- /* Take into calculation only the workers that are
+ /* Take into account only the workers that are
* not in error state, stopped, disabled or busy.
*/
activation = s->extension.activation ?
@@ -802,7 +815,7 @@ static int find_best_byvalue(jk_ws_servi
if (activation == JK_LB_ACTIVATION_UNSET)
activation = wr.activation;
- /* Take into calculation only the workers that are
+ /* Take into account only the workers that are
* not in error state, stopped, disabled or busy.
*/
if (JK_WORKER_USABLE(states[wr.i], activation)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]