JBoss Native SVN: r2347 - trunk/mod_cluster/test/java/org/jboss/mod_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-03-09 08:40:39 -0400 (Mon, 09 Mar 2009)
New Revision: 2347
Modified:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java
Log:
Fail early...
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java 2009-03-09 10:47:40 UTC (rev 2346)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java 2009-03-09 12:40:39 UTC (rev 2347)
@@ -96,6 +96,8 @@
ex.printStackTrace();
clienterror = true;
}
+ if (clienterror)
+ fail("Client error");
// Stop the connector that has received the request...
String node = client.getnode();
@@ -114,9 +116,6 @@
}
}
- if (clienterror)
- fail("Client error");
-
// Run a test on it. (it waits until httpd as received the nodes information).
client.setnode(node);
try {
15 years, 10 months
JBoss Native SVN: r2346 - trunk/mod_cluster/test/java.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-03-09 06:47:40 -0400 (Mon, 09 Mar 2009)
New Revision: 2346
Modified:
trunk/mod_cluster/test/java/apachectl.bat
Log:
try net start Apache2.2...
Modified: trunk/mod_cluster/test/java/apachectl.bat
===================================================================
--- trunk/mod_cluster/test/java/apachectl.bat 2009-03-09 09:34:31 UTC (rev 2345)
+++ trunk/mod_cluster/test/java/apachectl.bat 2009-03-09 10:47:40 UTC (rev 2346)
@@ -38,7 +38,8 @@
dir "@BASELOC(a)\httpd-2.2\logs"
del "@BASELOC(a)\httpd-2.2\logs\access_log"
del "@BASELOC(a)\httpd-2.2\logs\error_log"
-"@BASELOC(a)\httpd-2.2\bin\httpd.exe" -k start
+REM "@BASELOC(a)\httpd-2.2\bin\httpd.exe" -k start
+net start Apache2.2
dir "@BASELOC(a)\httpd-2.2\logs"
goto end
15 years, 10 months
JBoss Native SVN: r2345 - trunk/mod_cluster/test/java.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-03-09 05:34:31 -0400 (Mon, 09 Mar 2009)
New Revision: 2345
Modified:
trunk/mod_cluster/test/java/apachectl.bat
trunk/mod_cluster/test/java/build.xml
Log:
Tried to wait in ant :-)
Modified: trunk/mod_cluster/test/java/apachectl.bat
===================================================================
--- trunk/mod_cluster/test/java/apachectl.bat 2009-03-07 13:15:52 UTC (rev 2344)
+++ trunk/mod_cluster/test/java/apachectl.bat 2009-03-09 09:34:31 UTC (rev 2345)
@@ -24,16 +24,22 @@
@echo on
@if "%1" == "stop" goto stop
+@if "%1" == "start" goto start
"@BASELOC(a)\httpd-2.2\bin\httpd.exe" -k install
+dir "@BASELOC(a)\httpd-2.2\logs"
+goto end
+
+:start
REM install will test httpd but using the current user so remove the logs files.
REM wait a little (2 ways)
REM choice /c C /D C /t 30
-ping -n 31 localhost > NUL
+REM ping -n 31 localhost > NUL
dir "@BASELOC(a)\httpd-2.2\logs"
del "@BASELOC(a)\httpd-2.2\logs\access_log"
del "@BASELOC(a)\httpd-2.2\logs\error_log"
"@BASELOC(a)\httpd-2.2\bin\httpd.exe" -k start
+dir "@BASELOC(a)\httpd-2.2\logs"
goto end
:stop
Modified: trunk/mod_cluster/test/java/build.xml
===================================================================
--- trunk/mod_cluster/test/java/build.xml 2009-03-07 13:15:52 UTC (rev 2344)
+++ trunk/mod_cluster/test/java/build.xml 2009-03-09 09:34:31 UTC (rev 2345)
@@ -116,6 +116,13 @@
<arg value="start"/>
</exec>
<exec executable="apache.bat" os="Windows 2003">
+ <arg value="install"/>
+ </exec>
+ <!-- on windoze wait 30 seconds -->
+ <waitfor maxwait="30" maxwaitunit="second">
+ <available file="${base.apache}/opt/jboss/httpd/sbin/apachectl"/>
+ </waitfor>
+ <exec executable="apache.bat" os="Windows 2003">
<arg value="start"/>
</exec>
</target>
15 years, 10 months
JBoss Native SVN: r2344 - trunk/mod_cluster/native/mod_proxy_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-03-07 08:15:52 -0500 (Sat, 07 Mar 2009)
New Revision: 2344
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Oops should be done after manager_init().
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-07 11:46:26 UTC (rev 2343)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-07 13:15:52 UTC (rev 2344)
@@ -1293,7 +1293,16 @@
static int proxy_cluster_post_config(apr_pool_t *p, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
+ const char *userdata_key = "mod_cluster_init";
+ void *data;
+ apr_pool_userdata_get(&data, userdata_key, s->process->pool);
+ if (data && sessionid_storage) {
+ int nb_sessionid = sessionid_storage->get_max_size_sessionid();
+ if (! nb_sessionid)
+ sessionid_storage = NULL; /* don't use it */
+ }
+
/* Check that the mod_proxy_balancer.c is not loaded */
if (ap_find_linked_module("mod_proxy_balancer.c") != NULL) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
@@ -1331,10 +1340,6 @@
ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s,
"proxy_cluster_post_config: Can't find mod_manager for sessionids");
return !OK;
- } else {
- int nb_sessionid = sessionid_storage->get_max_size_sessionid();
- if (! nb_sessionid)
- sessionid_storage = NULL; /* don't use it */
}
return OK;
15 years, 10 months
JBoss Native SVN: r2343 - in trunk/mod_cluster/native: mod_proxy_cluster and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-03-07 06:46:26 -0500 (Sat, 07 Mar 2009)
New Revision: 2343
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Deactivate sessionid storing by default.
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-03-07 10:05:30 UTC (rev 2342)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-03-07 11:46:26 UTC (rev 2343)
@@ -54,7 +54,7 @@
#define DEFMAXCONTEXT 100
#define DEFMAXNODE 20
#define DEFMAXHOST 20
-#define DEFMAXSESSIONID 512
+#define DEFMAXSESSIONID 0 /* it has performance/security impact */
#define MAXMESSSIZE 1024
/* Error messages */
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-07 10:05:30 UTC (rev 2342)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-07 11:46:26 UTC (rev 2343)
@@ -1259,7 +1259,8 @@
/* Calculate the lbstatus for each node */
update_workers_lbstatus(conf, pool, s);
/* Free sessionid slots */
- remove_timeout_sessionid(conf, pool, s);
+ if (sessionid_storage)
+ remove_timeout_sessionid(conf, pool, s);
apr_pool_destroy(pool);
}
apr_thread_exit(thd, 0);
@@ -1330,6 +1331,10 @@
ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s,
"proxy_cluster_post_config: Can't find mod_manager for sessionids");
return !OK;
+ } else {
+ int nb_sessionid = sessionid_storage->get_max_size_sessionid();
+ if (! nb_sessionid)
+ sessionid_storage = NULL; /* don't use it */
}
return OK;
@@ -1375,7 +1380,8 @@
#endif
/* here we have the route and domain for find_session_route ... */
apr_table_setn(r->notes, "session-sticky", sticky_used);
- apr_table_setn(r->notes, "session-id", sessionid);
+ if (sessionid_storage)
+ apr_table_setn(r->notes, "session-id", sessionid);
apr_table_setn(r->notes, "session-route", route);
apr_table_setn(r->subprocess_env, "BALANCER_SESSION_ROUTE", route);
@@ -1896,7 +1902,6 @@
proxy_server_conf *conf)
{
- apr_status_t rv;
proxy_cluster_helper *helper;
const char *sessionid;
const char *route;
@@ -1916,40 +1921,43 @@
if (worker && worker->s->busy)
worker->s->busy--;
- /* Add information about sessions corresponding to a node */
- sticky = apr_table_get(r->notes, "session-sticky");
- if (sticky == NULL) {
- char *path, *stick;
- stick = apr_pstrdup(r->pool, balancer->sticky);
- if ((path = strchr(stick, '|'))) {
- *path++ = '\0';
+ if (sessionid_storage) {
+
+ /* Add information about sessions corresponding to a node */
+ sticky = apr_table_get(r->notes, "session-sticky");
+ if (sticky == NULL) {
+ char *path, *stick;
+ stick = apr_pstrdup(r->pool, balancer->sticky);
+ if ((path = strchr(stick, '|'))) {
+ *path++ = '\0';
+ }
+ sticky = (const char *) stick;
}
- sticky = (const char *) stick;
- }
- cookie = get_cookie_param(r, sticky, 0);
- sessionid = apr_table_get(r->notes, "session-id");
- route = apr_table_get(r->notes, "session-route");
- if (cookie) {
- if (sessionid && strcmp(cookie, sessionid)) {
- /* The cookie has changed, remove the old one and store the next one */
+ cookie = get_cookie_param(r, sticky, 0);
+ sessionid = apr_table_get(r->notes, "session-id");
+ route = apr_table_get(r->notes, "session-route");
+ if (cookie) {
+ if (sessionid && strcmp(cookie, sessionid)) {
+ /* The cookie has changed, remove the old one and store the next one */
+ sessionidinfo_t ou;
+ strncpy(ou.sessionid, sessionid, SESSIONIDSZ);
+ ou.id = 0;
+ sessionid_storage->remove_sessionid(&ou);
+ }
+ if ((oroute = strchr(cookie, '.')) != NULL )
+ oroute++;
+ route = oroute;
+ sessionid = cookie;
+ }
+
+ if (sessionid && route) {
sessionidinfo_t ou;
strncpy(ou.sessionid, sessionid, SESSIONIDSZ);
- ou.id = 0;
- sessionid_storage->remove_sessionid(&ou);
+ strncpy(ou.JVMRoute, route, JVMROUTESZ);
+ sessionid_storage->insert_update_sessionid(&ou);
}
- if ((oroute = strchr(cookie, '.')) != NULL )
- oroute++;
- route = oroute;
- sessionid = cookie;
}
- if (sessionid && route) {
- sessionidinfo_t ou;
- strncpy(ou.sessionid, sessionid, SESSIONIDSZ);
- strncpy(ou.JVMRoute, route, JVMROUTESZ);
- sessionid_storage->insert_update_sessionid(&ou);
- }
-
return OK;
}
15 years, 10 months
JBoss Native SVN: r2342 - trunk/mod_cluster/native/mod_proxy_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-03-07 05:05:30 -0500 (Sat, 07 Mar 2009)
New Revision: 2342
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
typo...
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-07 06:58:52 UTC (rev 2341)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-07 10:05:30 UTC (rev 2342)
@@ -1178,7 +1178,7 @@
char sport[7];
char *url;
apr_snprintf(sport, sizeof(sport), ":%d", worker->port);
- url = apr_pstrcat(r->pool, worker->scheme, "ajp://", worker->hostname, sport, "/", NULL);
+ url = apr_pstrcat(r->pool, worker->scheme, "://", worker->hostname, sport, "/", NULL);
rv = proxy_cluster_try_pingpong(r, worker, url, conf);
if (rv != APR_SUCCESS) {
worker->s->status |= PROXY_WORKER_IN_ERROR;
15 years, 10 months
JBoss Native SVN: r2341 - trunk/mod_cluster/native/mod_proxy_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-03-07 01:58:52 -0500 (Sat, 07 Mar 2009)
New Revision: 2341
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
remove useless lock.
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-06 16:22:37 UTC (rev 2340)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-07 06:58:52 UTC (rev 2341)
@@ -1904,21 +1904,10 @@
const char *sticky;
char *oroute;
- if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
- "proxy: CLUSTER: (%s). Lock failed for post_request",
- balancer->name);
- return HTTP_INTERNAL_SERVER_ERROR;
- }
/* mark the work as not use */
helper = (proxy_cluster_helper *) worker->opaque;
helper->count_active--;
- if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
- "proxy: CLUSTER: (%s). Unlock failed for post_request",
- balancer->name);
- }
#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy_cluster_post_request for (%s)", balancer->name);
15 years, 10 months
JBoss Native SVN: r2340 - trunk/mod_cluster/native/mod_proxy_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-03-06 11:22:37 -0500 (Fri, 06 Mar 2009)
New Revision: 2340
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Add #if HAVE_CLUSTER_EX_DEBUG to reduce the calls to ap_log_error().
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-06 11:08:46 UTC (rev 2339)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-06 16:22:37 UTC (rev 2340)
@@ -53,6 +53,9 @@
#include <unistd.h>
#endif
+/* define HAVE_CLUSTER_EX_DEBUG to have extented debug in mod_cluster */
+#define HAVE_CLUSTER_EX_DEBUG 0
+
struct proxy_cluster_helper {
int count_active; /* currently active request using the worker */
#if AP_MODULE_MAGIC_AT_LEAST(20051115,4)
@@ -733,8 +736,10 @@
sessionid = cluster_get_sessionid(r, balancer->sticky, uri, &sticky_used);
if (sessionid) {
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"mod_proxy_cluster: found sessionid %s", sessionid);
+#endif
return 1;
}
return 0;
@@ -764,8 +769,10 @@
sizevhost = host_storage->get_max_size_host();
vhosts = apr_palloc(r->pool, sizeof(int)*sizevhost);
sizevhost = host_storage->get_ids_used_host(vhosts);
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"get_balancer_by_node testing node %s for %s", node->mess.JVMRoute, r->uri);
+#endif
for (i=0; i<sizevhost; i++) {
hostinfo_t *vhost;
host_storage->read_host(vhosts[i], &vhost);
@@ -777,16 +784,20 @@
int sizecontext = context_storage->get_max_size_context();
int *contexts = apr_palloc(r->pool, sizeof(int)*sizecontext);
sizecontext = context_storage->get_ids_used_context(contexts);
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"get_balancer_by_node testing host %s", vhost->host);
+#endif
for (j=0; j<sizecontext; j++) {
contextinfo_t *context;
int len;
context_storage->read_context(contexts[j], &context);
if (context->vhost != vhost->vhost || (context->node != node->mess.id))
continue;
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"get_balancer_by_node testing context %s", context->context);
+#endif
/* check for /context[/] in the URL */
len = strlen(context->context);
@@ -868,8 +879,10 @@
static int isnode_domain_ok(request_rec *r, nodeinfo_t *node,
const char *domain)
{
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"isnode_domain_ok: domain %s:%s", domain, node->mess.Domain);
+#endif
if (domain == NULL)
return 1; /* OK no domain in the corresponding to the SESSIONID */
if (strcmp(node->mess.Domain, domain) == 0)
@@ -894,9 +907,11 @@
int checked_standby = 0;
int checked_domain = 1;
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: Entering byrequests for CLUSTER (%s)",
balancer->name);
+#endif
/* create workers for new nodes */
update_workers_node(conf, r->pool, r->server);
@@ -1339,19 +1354,25 @@
sessionid = cluster_get_sessionid(r, balancer->sticky, r->uri, &sticky_used);
if (sessionid) {
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found value %s for "
"stickysession %s", sessionid, balancer->sticky);
+#endif
if ((route = strchr(sessionid, '.')) != NULL )
route++;
if (route && *route) {
nodeinfo_t *ou;
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found route %s", route);
+#endif
if (node_storage->find_node(&ou, route) == APR_SUCCESS) {
if (strlen(balancer->name)>10 && !strcmp(&balancer->name[10], ou->mess.balancer)) {
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found balancer %s for %s", ou->mess.balancer, route);
+#endif
/* here we have the route and domain for find_session_route ... */
apr_table_setn(r->notes, "session-sticky", sticky_used);
apr_table_setn(r->notes, "session-id", sessionid);
@@ -1360,8 +1381,10 @@
apr_table_setn(r->subprocess_env, "BALANCER_SESSION_ROUTE", route);
apr_table_setn(r->subprocess_env, "BALANCER_SESSION_STICKY", sticky_used);
if (ou->mess.Domain[0] != '\0') {
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cluster: Found domain %s for %s", ou->mess.Domain, route);
+#endif
apr_table_setn(r->notes, "CLUSTER_DOMAIN", ou->mess.Domain);
}
return &balancer->name[10];
@@ -1385,9 +1408,11 @@
proxy_server_conf *conf = (proxy_server_conf *)
ap_get_module_config(sconf, &proxy_module);
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, r->server,
"proxy_cluster_trans for %d %s %s uri: %s args: %s unparsed_uri: %s",
r->proxyreq, r->filename, r->handler, r->uri, r->args, r->unparsed_uri);
+#endif
balancer = get_route_balancer(r, conf);
if (!balancer) {
@@ -1402,9 +1427,11 @@
r->filename = apr_pstrcat(r->pool, "proxy:cluster://", balancer, r->unparsed_uri, NULL);
r->handler = "proxy-server";
r->proxyreq = PROXYREQ_REVERSE;
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, r->server,
"proxy_cluster_trans using %s uri: %s",
balancer, r->filename);
+#endif
return OK; /* Mod_proxy will process it */
}
@@ -1854,9 +1881,11 @@
*/
access_status = rewrite_url(r, *worker, url);
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: CLUSTER (%s) worker (%s) rewritten to %s",
(*balancer)->name, (*worker)->name, *url);
+#endif
return access_status;
}
@@ -1890,8 +1919,10 @@
"proxy: CLUSTER: (%s). Unlock failed for post_request",
balancer->name);
}
+#if HAVE_CLUSTER_EX_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy_cluster_post_request for (%s)", balancer->name);
+#endif
if (worker && worker->s->busy)
worker->s->busy--;
15 years, 10 months
JBoss Native SVN: r2339 - trunk/mod_cluster/native/mod_proxy_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-03-06 06:08:46 -0500 (Fri, 06 Mar 2009)
New Revision: 2339
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
more optimisations :-(
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-06 10:49:56 UTC (rev 2338)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-06 11:08:46 UTC (rev 2339)
@@ -884,7 +884,7 @@
* stopped in one node but not in others.
* We also try the domain.
*/
-static proxy_worker *internal_find_best_byrequests(proxy_balancer *balancer,
+static proxy_worker *internal_find_best_byrequests(proxy_balancer *balancer, proxy_server_conf *conf,
request_rec *r, const char *domain, int failoverdomain)
{
int i;
@@ -893,9 +893,6 @@
int checking_standby = 0;
int checked_standby = 0;
int checked_domain = 1;
- void *sconf = r->server->module_config;
- proxy_server_conf *conf = (proxy_server_conf *)
- ap_get_module_config(sconf, &proxy_module);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: Entering byrequests for CLUSTER (%s)",
@@ -986,17 +983,6 @@
}
return mycandidate;
}
-static proxy_worker *find_best_byrequests(proxy_balancer *balancer,
- request_rec *r)
-{
- return (internal_find_best_byrequests(balancer, r, NULL, 0));
-}
-static const proxy_balancer_method byrequests =
-{
- "byrequests",
- &find_best_byrequests,
- NULL
-};
/*
* Do a ping/pong to the node
@@ -1556,7 +1542,7 @@
return worker;
}
-static proxy_worker *find_best_worker(proxy_balancer *balancer,
+static proxy_worker *find_best_worker(proxy_balancer *balancer, proxy_server_conf *conf,
request_rec *r, const char *domain, int failoverdomain)
{
proxy_worker *candidate = NULL;
@@ -1569,7 +1555,7 @@
}
/* XXX: candidate = (*balancer->lbmethod->finder)(balancer, r); */
- candidate = internal_find_best_byrequests(balancer, r, domain, failoverdomain);
+ candidate = internal_find_best_byrequests(balancer, conf, r, domain, failoverdomain);
if (candidate) {
proxy_cluster_helper *helper;
@@ -1607,7 +1593,7 @@
while (tval < timeout) {
apr_sleep(step);
/* Try again */
- if ((candidate = find_best_worker(balancer, r, domain, failoverdomain)))
+ if ((candidate = find_best_worker(balancer, conf, r, domain, failoverdomain)))
break;
tval += step;
}
@@ -1818,7 +1804,7 @@
/*
* We have to failover (in domain only may be) or we don't use sticky sessions
*/
- runtime = find_best_worker(*balancer, r, domain, failoverdomain);
+ runtime = find_best_worker(*balancer, conf, r, domain, failoverdomain);
if (!runtime) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"proxy: CLUSTER: (%s). All workers are in error state",
@@ -1957,9 +1943,6 @@
ap_hook_post_config(proxy_cluster_post_config, NULL, NULL, APR_HOOK_MIDDLE);
- /* create the provider for the proxy logic */
- ap_register_provider(p, PROXY_LBMETHOD, "cluster_byrequests", "0", &byrequests);
-
/* create the "maintenance" thread */
ap_hook_child_init(proxy_cluster_child_init, NULL, NULL, APR_HOOK_MIDDLE);
15 years, 10 months
JBoss Native SVN: r2338 - trunk/mod_cluster/native/mod_proxy_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-03-06 05:49:56 -0500 (Fri, 06 Mar 2009)
New Revision: 2338
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Optimise the number of calls to ap_get_module_config.
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-05 15:03:40 UTC (rev 2337)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2009-03-06 10:49:56 UTC (rev 2338)
@@ -1337,16 +1337,13 @@
/**
* Find the balancer corresponding to the node information
*/
-static const char *get_route_balancer(request_rec *r)
+static const char *get_route_balancer(request_rec *r, proxy_server_conf *conf)
{
proxy_balancer *balancer;
char *route = NULL;
char *sessionid = NULL;
char *sticky_used;
int i;
- void *sconf = r->server->module_config;
- proxy_server_conf *conf = (proxy_server_conf *)
- ap_get_module_config(sconf, &proxy_module);
balancer = (proxy_balancer *)conf->balancers->elts;
for (i = 0; i < conf->balancers->nelts; i++, balancer++) {
@@ -1398,19 +1395,19 @@
static int proxy_cluster_trans(request_rec *r)
{
const char *balancer;
+ void *sconf = r->server->module_config;
+ proxy_server_conf *conf = (proxy_server_conf *)
+ ap_get_module_config(sconf, &proxy_module);
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, r->server,
"proxy_cluster_trans for %d %s %s uri: %s args: %s unparsed_uri: %s",
r->proxyreq, r->filename, r->handler, r->uri, r->args, r->unparsed_uri);
- balancer = get_route_balancer(r);
+ balancer = get_route_balancer(r, conf);
if (!balancer) {
- void *sconf = r->server->module_config;
- proxy_server_conf *conf = (proxy_server_conf *)
- ap_get_module_config(sconf, &proxy_module);
/* May be the balancer has not been created (XXX: use shared memory to find the balancer ...) */
update_workers_node(conf, r->pool, r->server);
- balancer = get_route_balancer(r);
+ balancer = get_route_balancer(r, conf);
}
if (!balancer)
balancer = get_context_host_balancer(r);
15 years, 10 months