You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2011/05/20 18:29:49 UTC
svn commit: r1125451 - in /httpd/httpd/trunk: docs/manual/mod/mod_proxy.xml
include/ap_mmn.h modules/proxy/mod_proxy.c modules/proxy/mod_proxy.h
modules/proxy/mod_proxy_balancer.c
Author: jim
Date: Fri May 20 16:29:48 2011
New Revision: 1125451
URL: http://svn.apache.org/viewvc?rev=1125451&view=rev
Log:
Add in BalancerGrowth and its functionality... this lays
the framework for adding additional Balancers: post-config
by allowing for shm growth.
Modified:
httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
httpd/httpd/trunk/include/ap_mmn.h
httpd/httpd/trunk/modules/proxy/mod_proxy.c
httpd/httpd/trunk/modules/proxy/mod_proxy.h
httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
Modified: httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml?rev=1125451&r1=1125450&r2=1125451&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml Fri May 20 16:29:48 2011
@@ -637,31 +637,47 @@ expressions</description>
</directivesynopsis>
<directivesynopsis>
-<name>BalancerMember</name>
-<description>Add a member to a load balancing group</description>
-<syntax>BalancerMember [<var>balancerurl</var>] <var>url</var> [<var
- >key=value [key=value ...]]</var></syntax>
-<contextlist><context>directory</context>
-</contextlist>
-<compatibility>BalancerMember is only available in Apache HTTP Server 2.2
+<name>BalancerGrowth</name>
+<description>Number of additional Balancers that can be added Post-configuration</description>
+ <syntax>BalancerGrowth <var>#</var></syntax>
+ <default>BalancerGrowth 5</default>
+ <contextlist><context>server config</context><context>virtual host</context></contextlist>
+<compatibility>BalancerGrowth is only available in Apache HTTP Server 2.3.13
and later.</compatibility>
<usage>
- <p>This directive adds a member to a load balancing group. It could be used
- within a <code><Proxy <var>balancer://</var>...></code> container
- directive, and can take any of the key value pair parameters available to
- <directive module="mod_proxy">ProxyPass</directive> directives.</p>
- <p>One additional parameter is available only to <directive
- module="mod_proxy">BalancerMember</directive> directives:
- <var>loadfactor</var>. This is the member load factor - a number between 1
- (default) and 100, which defines the weighted load to be applied to the
- member in question.</p>
- <p>The balancerurl is only needed when not in <code><Proxy <var>balancer://</var>...></code>
- container directive. It corresponds to the url of a balancer defined in
- <directive module="mod_proxy">ProxyPass</directive> directive.</p>
+ <p>This directive allows for growth potential in the number of
+ Balancers available for a virtualhost in addition to the
+ number pre-configured. It only take effect if there is at
+ least 1 pre-configured Balancer.</p>
</usage>
</directivesynopsis>
<directivesynopsis>
+ <name>BalancerMember</name>
+ <description>Add a member to a load balancing group</description>
+ <syntax>BalancerMember [<var>balancerurl</var>] <var>url</var> [<var
+ >key=value [key=value ...]]</var></syntax>
+ <contextlist><context>directory</context>
+ </contextlist>
+ <compatibility>BalancerMember is only available in Apache HTTP Server 2.2
+ and later.</compatibility>
+ <usage>
+ <p>This directive adds a member to a load balancing group. It could be used
+ within a <code><Proxy <var>balancer://</var>...></code> container
+ directive, and can take any of the key value pair parameters available to
+ <directive module="mod_proxy">ProxyPass</directive> directives.</p>
+ <p>One additional parameter is available only to <directive
+ module="mod_proxy">BalancerMember</directive> directives:
+ <var>loadfactor</var>. This is the member load factor - a number between 1
+ (default) and 100, which defines the weighted load to be applied to the
+ member in question.</p>
+ <p>The balancerurl is only needed when not in <code><Proxy <var>balancer://</var>...></code>
+ container directive. It corresponds to the url of a balancer defined in
+ <directive module="mod_proxy">ProxyPass</directive> directive.</p>
+ </usage>
+</directivesynopsis>
+
+<directivesynopsis>
<name>ProxySet</name>
<description>Set various Proxy balancer or member parameters</description>
<syntax>ProxySet <var>url</var> <var>key=value [key=value ...]</var></syntax>
Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1125451&r1=1125450&r2=1125451&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Fri May 20 16:29:48 2011
@@ -321,6 +321,7 @@
* change AP_DECLARE to AP_CORE_DECLARE: ap_register_log_hooks()
* 20110329.2 (2.3.12-dev) Add child_status and end_generation hooks.
* 20110329.3 (2.3.12-dev) Add format field to ap_errorlog_info.
+ * 20110329.4 (2.3.13-dev) bgrowth and max_balancers to proxy_server_conf.
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -328,7 +329,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20110329
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 3 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 4 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=1125451&r1=1125450&r2=1125451&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Fri May 20 16:29:48 2011
@@ -1127,6 +1127,9 @@ static void * create_proxy_config(apr_po
ps->viaopt = via_off; /* initially backward compatible with 1.3.1 */
ps->viaopt_set = 0; /* 0 means default */
ps->req = 0;
+ ps->max_balancers = 0;
+ ps->bgrowth = 5;
+ ps->bgrowth_set = 0;
ps->req_set = 0;
ps->recv_buffer_size = 0; /* this default was left unset for some reason */
ps->recv_buffer_size_set = 0;
@@ -1167,6 +1170,9 @@ static void * merge_proxy_config(apr_poo
ps->viaopt_set = overrides->viaopt_set || base->viaopt_set;
ps->req = (overrides->req_set == 0) ? base->req : overrides->req;
ps->req_set = overrides->req_set || base->req_set;
+ ps->bgrowth = (overrides->bgrowth_set == 0) ? base->bgrowth : overrides->bgrowth;
+ ps->bgrowth_set = overrides->bgrowth_set || base->bgrowth_set;
+ ps->max_balancers = overrides->max_balancers || base->max_balancers;
ps->recv_buffer_size = (overrides->recv_buffer_size_set == 0) ? base->recv_buffer_size : overrides->recv_buffer_size;
ps->recv_buffer_size_set = overrides->recv_buffer_size_set || base->recv_buffer_size_set;
ps->io_buffer_size = (overrides->io_buffer_size_set == 0) ? base->io_buffer_size : overrides->io_buffer_size;
@@ -1824,6 +1830,21 @@ static const char*
return NULL;
}
+static const char *set_bgrowth(cmd_parms *parms, void *dummy, const char *arg)
+{
+ proxy_server_conf *psf =
+ ap_get_module_config(parms->server->module_config, &proxy_module);
+
+ int growth = atoi(arg);
+ if (growth < 0 || growth > 1000) {
+ return "BalancerGrowth must be between 0 and 1000";
+ }
+ psf->bgrowth = growth;
+ psf->bgrowth_set = 1;
+
+ return NULL;
+}
+
static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
@@ -2203,6 +2224,8 @@ static const command_rec proxy_cmds[] =
"How to handle bad header line in response: IsError | Ignore | StartBody"),
AP_INIT_RAW_ARGS("BalancerMember", add_member, NULL, RSRC_CONF|ACCESS_CONF,
"A balancer name and scheme with list of params"),
+ AP_INIT_TAKE1("BalancerGrowth", set_bgrowth, NULL, RSRC_CONF,
+ "Number of additional Balancers that can be added post-config"),
AP_INIT_TAKE1("ProxyStatus", set_status_opt, NULL, RSRC_CONF,
"Configure Status: proxy status to one of: on | off | full"),
AP_INIT_RAW_ARGS("ProxySet", set_proxy_param, NULL, RSRC_CONF|ACCESS_CONF,
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=1125451&r1=1125450&r2=1125451&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Fri May 20 16:29:48 2011
@@ -138,6 +138,8 @@ typedef struct {
const char *id;
apr_pool_t *pool; /* Pool used for allocating this struct */
int req; /* true if proxy requests are enabled */
+ int max_balancers; /* maximum number of allowed balancers */
+ int bgrowth; /* number of post-config balancers can added */
enum {
via_off,
via_on,
@@ -172,6 +174,7 @@ typedef struct {
unsigned int badopt_set:1;
unsigned int proxy_status_set:1;
unsigned int source_address_set:1;
+ unsigned int bgrowth_set:1;
} proxy_server_conf;
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c?rev=1125451&r1=1125450&r2=1125451&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c Fri May 20 16:29:48 2011
@@ -723,13 +723,14 @@ static int balancer_post_config(apr_pool
conf = (proxy_server_conf *)ap_get_module_config(sconf, &proxy_module);
if (conf->balancers->nelts) {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "Doing balancers create: %d, %d",
+ conf->max_balancers = conf->balancers->nelts + conf->bgrowth;
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "Doing balancers create: %d, %d (%d)",
(int)ALIGNED_PROXY_BALANCER_SHARED_SIZE,
- (int)conf->balancers->nelts);
+ (int)conf->balancers->nelts, conf->max_balancers);
rv = storage->create(&new, conf->id,
ALIGNED_PROXY_BALANCER_SHARED_SIZE,
- conf->balancers->nelts, AP_SLOTMEM_TYPE_PREGRAB, pconf);
+ conf->max_balancers, AP_SLOTMEM_TYPE_PREGRAB, pconf);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "balancer slotmem_create failed");
return !OK;