Commit 22c21c07 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r427172 from trunk:

Add in a very simple balancer "set" concept, which allows
for members to be assigned to a particular cluster set
such that members in lower-numbered sets are checked/used
before those in higher ones.

Also bundled in this are some HTML cleanups for the balancer
manager UI. Sorry for the mixins :)

Compiles/builds clean: passes test framework as well
as more normal usage tests ;)

Reviewed by: jim
Merge r427368, r428352, r428361, r432352 from trunk:

Reset standby flags for each loop through the cluster sets


Initialization change. Move to a different format
to force resets as well as a common technique, in case
_route is updated at some point.


Update docs for proxy:

  1. Put params in abc order
  2. Add hot-standby example
  3. Add in new features that hadn't been documented yet (lbset, ...)

Reviewed by: jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@440800 13f79535-47bb-0310-9956-ffa450edef68
parent 6c729a23
Loading
Loading
Loading
Loading
+4 −0
Changes for CHANGES: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
                                                        -*- coding: utf-8 -*-
Changes with Apache 2.2.4
  *) mod_proxy_balancer: Workers can now be defined as part of
     a balancer cluster "set" in which members of a lower-numbered set
     are preferred over higher numbered ones. [Jim Jagielski]
  *) mod_proxy_balancer: Workers can now be defined as "hot standby" which
     will only be used if all other workers are unusable (eg: in
     error or disabled). Also, the balancer-manager displays the election
+0 −12
Changes for STATUS: 0 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -86,18 +86,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
        http://people.apache.org/~wrowe/mod_isapi-416293-to-httpd-2.2.patch
      +1 wrowe , fielding, jerenkrantz

    * mod_proxy_balancer: Add in load balancer cluster set capability
      (with docs)
      Trunk version of patch:
        http://svn.apache.org/viewvc?view=rev&revision=427172
        http://svn.apache.org/viewvc?view=rev&revision=427368
        http://svn.apache.org/viewvc?view=rev&revision=428352
        http://svn.apache.org/viewvc?view=rev&revision=428361
        http://svn.apache.org/viewvc?view=rev&revision=432352 (partial doc)
      2.2.x version of patch:
        http://people.apache.org/~jim/patches/lbset.patch (unified from above)
      +1: jim, mturk, rpluem

    * mod_ext_filter: Handle filter names which include capital letters.
      PR 40323.
      Trunk patch, which applies:
+23 −1
Changes for docs/manual/mod/mod_proxy.xml: 23 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -578,6 +578,12 @@ expressions</description>
    generally 120ms), and thus prevent the firewall to drop the connection.
    To enable keepalive set this property value to <code>On</code>. 
    </td></tr>
    <tr><td>lbset</td>
        <td>0</td>
        <td>Sets the load balancer cluster set that the worker is a member
         of. The load balancer will try all members of a lower numbered
         lbset before trying higher numbered ones.
    </td></tr>
    <tr><td>loadfactor</td>
        <td>1</td>
        <td>Worker load factor. Used with BalancerMember.
@@ -608,7 +614,7 @@ expressions</description>
    <tr><td>status</td>
        <td>-</td>
        <td>Single letter value defining the initial status of
        this worker: 'D' is disabled, 'S' is stopped
        this worker: 'D' is disabled, 'S' is stopped, 'H' is hot-standby
        and 'E' is in an error state. Status can be set (which is the default)
        by prepending with '+' or cleared by prepending with '-'.
        Thus, a setting of 'S-E' sets this worker to Stopped and
@@ -686,6 +692,22 @@ expressions</description>
      &lt;/Proxy&gt;
    </example>

    <p>Setting up a hot-standby, that will only be used if no other
     members are available</p>
    <example>
      ProxyPass / balancer://hotcluster/ <br />
      &lt;Proxy balancer://hotcluster&gt;<br />
      <indent>
        BalancerMember http://1.2.3.4:8009 loadfactor=1<br />
        BalancerMember http://1.2.3.5:8009 loadfactor=2<br />
        # The below is the hot standby<br />
        BalancerMember http://1.2.3.6:8009 status=+H<br />
        ProxySet lbmethod=bytraffic
      </indent>
      &lt;/Proxy&gt;
    </example>

    
    <p>When used inside a <directive type="section" module="core"
    >Location</directive> section, the first argument is omitted and the local
    directory is obtained from the <directive type="section" module="core"
+9 −2
Changes for modules/proxy/mod_proxy.c: 9 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -244,6 +244,12 @@ static const char *set_worker_param(apr_pool_t *p,
        else
            worker->flush_wait = ival * 1000;    /* change to microseconds */
    }
    else if (!strcasecmp(key, "lbset")) {
        ival = atoi(val);
        if (ival < 0 || ival > 99)
            return "lbset must be between 0 and 99";
        worker->lbset = ival;
    }
    else {
        return "unknown Worker parameter";
    }
@@ -1800,7 +1806,7 @@ static int proxy_status_hook(request_rec *r, int flags)
        ap_rputs("\n\n<table border=\"0\"><tr>"
                 "<th>Sch</th><th>Host</th><th>Stat</th>"
                 "<th>Route</th><th>Redir</th>"
                 "<th>F</th><th>Acc</th><th>Wr</th><th>Rd</th>"
                 "<th>F</th><th>Set</th><th>Acc</th><th>Wr</th><th>Rd</th>"
                 "</tr>\n", r);

        worker = (proxy_worker *)balancer->workers->elts;
@@ -1819,7 +1825,8 @@ static int proxy_status_hook(request_rec *r, int flags)
            ap_rvputs(r, "</td><td>", worker->s->route, NULL);
            ap_rvputs(r, "</td><td>", worker->s->redirect, NULL);
            ap_rprintf(r, "</td><td>%d</td>", worker->s->lbfactor);
            ap_rprintf(r, "<td>%d</td><td>", (int)(worker->s->elected));
            ap_rprintf(r, "<td>%d</td>", worker->s->lbset);
            ap_rprintf(r, "<td>%" APR_SIZE_T_FMT "</td><td>", worker->s->elected);
            ap_rputs(apr_strfsize(worker->s->transferred, fbuf), r);
            ap_rputs("</td><td>", r);
            ap_rputs(apr_strfsize(worker->s->read, fbuf), r);
+3 −0
Changes for modules/proxy/mod_proxy.h: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -279,6 +279,8 @@ typedef struct {
    char            route[PROXY_WORKER_MAX_ROUTE_SIZ+1];
    char            redirect[PROXY_WORKER_MAX_ROUTE_SIZ+1];
    void            *context;   /* general purpose storage */
    apr_size_t      busy;       /* busyness factor */
    int             lbset;      /* load balancer cluster set */
} proxy_worker_stat;

/* Worker configuration */
@@ -322,6 +324,7 @@ struct proxy_worker {
         flush_auto
    } flush_packets;           /* control AJP flushing */
    int             flush_wait;  /* poll wait time in microseconds if flush_auto */
    int             lbset;      /* load balancer cluster set */
};

/*
Loading