mturk       2004/08/11 03:49:49

  Modified:    ajp/proxy proxy_util.c
  Log:
  Added dynamic worker limit. It ensures that the addng dynamic
  workers to the balancers never excedes that limit.
  
  Revision  Changes    Path
  1.26      +14 -2     jakarta-tomcat-connectors/ajp/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/proxy/proxy_util.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- proxy_util.c      10 Aug 2004 18:06:49 -0000      1.25
  +++ proxy_util.c      11 Aug 2004 10:49:49 -0000      1.26
  @@ -26,6 +26,7 @@
   
   /* Global balancer counter */
   static int lb_workers = 0;
  +static int lb_workers_limit = 0;
   
   static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r);
   static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r);
  @@ -1157,8 +1158,17 @@
   
       ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &mpm_daemons);
       /* Check if we are prefork or single child */
  -    if (worker->hmax && mpm_daemons > 1)
  +    if (worker->hmax && mpm_daemons > 1) {
  +        /* Check only if workers_limit is set */
  +        if (lb_workers_limit && (lb_workers + 1) > lb_workers_limit) {
  +            ap_log_perror(APLOG_MARK, APLOG_ERR, 0, pool,
  +                          "proxy: Can not add worker (%s) to balancer (%s)."
  +                          " Dynamic limit reached.",
  +                          worker->name, balancer->name);
  +            return;
  +        }
           score = ap_get_scoreboard_lb(getpid(), lb_workers);
  +    }
       else
   #endif
       {
  @@ -1859,5 +1869,7 @@
   
   PROXY_DECLARE(int) ap_proxy_lb_workers(void)
   {
  -    return (lb_workers + PROXY_DYNAMIC_BALANCER_LIMIT);
  +    /* Set the dynamic #workers limit */
  +    lb_workers_limit = lb_workers + PROXY_DYNAMIC_BALANCER_LIMIT;
  +    return lb_workers_limit;
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to