modules/proxy/balancers/mod_lbmethod_byrequests.c
/*
 * The idea behind the find_best_byrequests scheduler is the following:
 *
 * lbfactor is "how much we expect this worker to work", or "the worker's
 * normalized work quota".
 *
 * lbstatus is "how urgent this worker has to work to fulfill its quota
 * of work".
 *
 * We distribute each worker's work quota to the worker, and then look
 * which of them needs to work most urgently (biggest lbstatus).  This
 * worker is then selected for work, and its lbstatus reduced by the
 * total work quota we distributed to all workers.  Thus the sum of all
 * lbstatus does not change.(*)
 *
 * If some workers are disabled, the others will
 * still be scheduled correctly.
 *
 * If a balancer is configured as follows:
 *
 * worker     a    b    c    d
 * lbfactor  25   25   25   25
 *
 * And b gets disabled, the following schedule is produced:
 *
 *    a c d a c d a c d ...
 *
 * Note that the above lbfactor setting is the *exact* same as:
 *
 * worker     a    b    c    d
 * lbfactor   1    1    1    1
 *
 * Asymmetric configurations work as one would expect. For
 * example:
 *
 * worker     a    b    c    d
 * lbfactor   1    1    1    2
 *
 * would have a, b and c all handling about the same
 * amount of load with d handling twice what a or b
 * or c handles individually. So we could see:
 *
 *   b a d c d a c d b d ...
 *
 */
The idea behind the find_best_byrequests scheduler is the following:
lbfactor is "how much we expect this worker to work", or "the worker's
normalized work quota".

lbstatus is "how urgent this worker has to work to fulfill its quota
of work".

We distribute each worker's work quota to the worker, and then look
which of them needs to work most urgently (biggest lbstatus).  This
worker is then selected for work, and its lbstatus reduced by the
total work quota we distributed to all workers.  Thus the sum of all
lbstatus does not change.(*)

If some workers are disabled, the others will
still be scheduled correctly.

If a balancer is configured as follows.



And b gets disabled, the following schedule is produced.



Note that the above lbfactor setting is the *exact* same as.



Asymmetric configurations work as one would expect. For
example.

worker     a    b    c    d
lbfactor   1    1    1    2

would have a, b and c all handling about the same
amount of load with d handling twice what a or b
or c handles individually. So we could see.


The idea behind the find_best_byrequests scheduler is the following : lbfactor is " how much we expect this worker to work " or " the worker ' s normalized work quota " . lbstatus is " how urgent this worker has to work to fulfill its quota of work " . We distribute each worker ' s work quota to the worker and then look which of them needs to work most urgently ( biggest lbstatus ) . This worker is then selected for work and its lbstatus reduced by the total work quota we distributed to all workers . Thus the sum of all lbstatus does not change . ( * ) If some workers are disabled the others will still be scheduled correctly . If a balancer is configured as follows . And b gets disabled the following schedule is produced . Note that the above lbfactor setting is the * exact * same as . Asymmetric configurations work as one would expect . For example . worker a b c d lbfactor 1 1 1 2 would have a b and c all handling about the same amount of load with d handling twice what a or b or c handles individually . So we could see .
static proxy_worker *find_best_byrequests(proxy_balancer *balancer,
                                request_rec *r)
{
    int total_factor = 0;
    proxy_worker *worker = ap_proxy_balancer_get_best_worker(balancer, r, is_best_byrequests, &total_factor);
    if (worker) {
        worker->s->lbstatus -= total_factor;
        }
    return worker;
                }
static proxy_worker * find_best_byrequests ( proxy_balancer * balancer , request_rec * r ) { int total_factor = 0 ; proxy_worker * worker = ap_proxy_balancer_get_best_worker ( balancer , r , is_best_byrequests , & total_factor ) ; if ( worker ) { worker -> s -> lbstatus -= total_factor ; } return worker ; }
The idea behind the find_best_byrequests scheduler is the following:
 lbfactor is "how much we expect this worker to work", or "the worker's
 normalized work quota".
The idea behind the find_best_byrequests scheduler is the following : lbfactor is " how much we expect this worker to work " or " the worker ' s normalized work quota " .