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

Arrange the bybusyness logic and prevent bad busy values

this closes #383


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1912245 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Frederic Clere
2023-09-11 13:50:21 +00:00
parent a077812a1b
commit 1b9292a4c9
4 changed files with 168 additions and 17 deletions

View File

@@ -17,6 +17,7 @@
/* Load balancer module for Apache proxy */
#include "mod_proxy.h"
#include "proxy_util.h"
#include "scoreboard.h"
#include "ap_mpm.h"
#include "apr_version.h"
@@ -486,17 +487,6 @@ static void force_recovery(proxy_balancer *balancer, server_rec *s)
}
}
static apr_status_t decrement_busy_count(void *worker_)
{
proxy_worker *worker = worker_;
if (worker->s->busy) {
worker->s->busy--;
}
return APR_SUCCESS;
}
static int proxy_balancer_pre_request(proxy_worker **worker,
proxy_balancer **balancer,
request_rec *r,
@@ -635,7 +625,7 @@ static int proxy_balancer_pre_request(proxy_worker **worker,
*worker = runtime;
}
(*worker)->s->busy++;
increment_busy_count(*worker);
apr_pool_cleanup_register(r->pool, *worker, decrement_busy_count,
apr_pool_cleanup_null);
@@ -1575,7 +1565,7 @@ static void balancer_display_page(request_rec *r, proxy_server_conf *conf,
"</httpd:redirect>\n", NULL);
ap_rprintf(r,
" <httpd:busy>%" APR_SIZE_T_FMT "</httpd:busy>\n",
worker->s->busy);
getbusy_count(worker));
ap_rprintf(r, " <httpd:lbset>%d</httpd:lbset>\n",
worker->s->lbset);
/* End proxy_worker_stat */
@@ -1748,7 +1738,7 @@ static void balancer_display_page(request_rec *r, proxy_server_conf *conf,
ap_rvputs(r, ap_proxy_parse_wstatus(r->pool, worker), NULL);
ap_rputs("</td>", r);
ap_rprintf(r, "<td>%" APR_SIZE_T_FMT "</td>", worker->s->elected);
ap_rprintf(r, "<td>%" APR_SIZE_T_FMT "</td>", worker->s->busy);
ap_rprintf(r, "<td>%" APR_SIZE_T_FMT "</td>", getbusy_count(worker));
ap_rprintf(r, "<td>%d</td><td>", worker->s->lbstatus);
ap_rputs(apr_strfsize(worker->s->transferred, fbuf), r);
ap_rputs("</td><td>", r);