Dear All,
I enclose a patch to mod_rewrite, which is intended to address load
balancing through randomized plain text files. In our experience, the
load balancing is not even when we use more than two backed servers,
which we attribute to the rounding through sprintf (with the result that
the first and last servers get less than their fair share of requests).
For example, in a test-run 300 requests to three servers and the line
test www1|www2|www3
we see the following numbers:
www1 102 hits, www2 205 hits www3 93 hits.
Over a long period of time it tends to a ratio of 1:2:1
The attached patch (to 1.3.6, but I don't think the routine affected,
rewrite_rand, has changed since.) dopts a slightly different way of
choosing a random server. In our testing the ration in the above
example (and in others) tends to 1:1:1.
Can anyone see any reason why this patch shouldn't be applied?
Michael Smith
|