Author: jfrederic.clere(a)jboss.com
Date: 2008-09-30 11:45:58 -0400 (Tue, 30 Sep 2008)
New Revision: 1921
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Add a forget factor to prevent big value due to requests with sessionid and route on a
single node.
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-09-30 12:23:10 UTC
(rev 1920)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-09-30 15:45:58 UTC
(rev 1921)
@@ -65,6 +65,8 @@
#define WAITFORREMOVE 10 /* seconds */
+#define FORGETFACTOR 1000 /* Stop changing node lbstatus when too small or too big */
+
/*
* Create/Get the worker before using it
*/
@@ -820,7 +822,8 @@
mycandidate = worker;
break; /* Done */
} else {
- worker->s->lbstatus += worker->s->lbfactor;
+ if (worker->s->lbstatus < FORGETFACTOR *
worker->s->lbfactor)
+ worker->s->lbstatus += worker->s->lbfactor;
total_factor += worker->s->lbfactor;
if (!mycandidate
|| worker->s->busy < mycandidate->s->busy
@@ -837,7 +840,8 @@
}
if (mycandidate) {
- mycandidate->s->lbstatus -= total_factor;
+ if (mycandidate->s->lbstatus > - FORGETFACTOR *
mycandidate->s->lbfactor)
+ mycandidate->s->lbstatus -= total_factor;
mycandidate->s->elected++;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: byrequests balancer DONE (%s)",
mycandidate->name);
@@ -1527,12 +1531,14 @@
* on the LB implementation
*/
if (PROXY_WORKER_IS_USABLE(workers)) {
- workers->s->lbstatus += workers->s->lbfactor;
+ if (workers->s->lbstatus < FORGETFACTOR *
workers->s->lbfactor)
+ workers->s->lbstatus += workers->s->lbfactor;
total_factor += workers->s->lbfactor;
}
workers++;
}
- runtime->s->lbstatus -= total_factor;
+ if (runtime->s->lbstatus > - FORGETFACTOR * runtime->s->lbfactor)
+ runtime->s->lbstatus -= total_factor;
runtime->s->elected++;
*worker = runtime;
Show replies by date