httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/modules/proxy proxy_balancer.c
Date Wed, 11 Aug 2004 22:58:30 GMT
wrowe       2004/08/11 15:58:30

  Modified:    modules/proxy proxy_balancer.c
  Log:
  The lbstatus needs to be updated for every worker, not just the candidate.
  
  Submitted by: mturk
  
  Revision  Changes    Path
  1.3       +20 -8     httpd-2.0/modules/proxy/proxy_balancer.c
  
  Index: proxy_balancer.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_balancer.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- proxy_balancer.c	11 Aug 2004 22:58:03 -0000	1.2
  +++ proxy_balancer.c	11 Aug 2004 22:58:30 -0000	1.3
  @@ -134,7 +134,7 @@
                                                 request_rec *r)
   {
       int i;
  -    double total_status = 0.0;
  +    double total_factor = 0.0;
       proxy_runtime_worker *worker = (proxy_runtime_worker *)balancer->workers->elts;
       proxy_runtime_worker *candidate = NULL;
   
  @@ -153,7 +153,11 @@
                   if (worker->w->cp->nfree > candidate->w->cp->nfree)
                       candidate = worker;
               }
  -            total_status += worker->lbstatus;
  +            /* Total factor should allways be 100.
  +             * This is for cases when worker is in error state.
  +             * It will force the even request distribution
  +             */
  +            total_factor += worker->lbfactor;
           }
           worker++;
       }
  @@ -204,12 +208,20 @@
               }
               worker++;
           }
  -        /* XXX: The lbfactor can be update using bytes transfered
  -         * Right now, use the round-robin scheme
  -         */
  -        candidate->lbstatus += candidate->lbfactor;
  -        if (candidate->lbstatus >= total_status)
  -            candidate->lbstatus = candidate->lbfactor;
  +        for (i = 0; i < balancer->workers->nelts; i++) {
  +            /* If the worker is not error state
  +             * or not in disabled mode
  +             */
  +            if (worker->w->status > 2) {
  +                /* XXX: The lbfactor can be update using bytes transfered
  +                 * Right now, use the round-robin scheme
  +                 */
  +                worker->lbstatus += worker->lbfactor;
  +                if (worker->lbstatus >= total_factor)
  +                    worker->lbstatus = worker->lbfactor;
  +            }
  +            worker++;
  +        }
       }
       return candidate;
   }
  
  
  

Mime
View raw message