1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Added dynamic worker limit. It ensures that the addng dynamic

workers to the balancers never excedes that limit.

Submitted by: mturk


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104625 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
William A. Rowe Jr
2004-08-11 23:10:35 +00:00
parent 855a0c323b
commit 9b549607fc

View File

@@ -26,6 +26,7 @@
/* Global balancer counter */ /* Global balancer counter */
static int lb_workers = 0; 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_ipaddr(struct dirconn_entry *This, request_rec *r);
static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r); static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r);
@@ -1157,8 +1158,17 @@ ap_proxy_add_worker_to_balancer(apr_pool_t *pool, proxy_balancer *balancer, prox
ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &mpm_daemons); ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &mpm_daemons);
/* Check if we are prefork or single child */ /* 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); score = ap_get_scoreboard_lb(getpid(), lb_workers);
}
else else
#endif #endif
{ {
@@ -1859,5 +1869,7 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
PROXY_DECLARE(int) ap_proxy_lb_workers(void) 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;
} }