Reputation: 25
Apache has 3 load balancing algorithm:
Theoretically, pending request counting algorithm is better than the other two because it will always try to choose web server with the least-active connection.
I have 3 web servers and 1 load balancer. My question is, when I try pending request counting algorithm, it didn't work as expected. It always choose web server in round-robin basis (web server 1 -> web server 2 -> web server 3 -> web server 1, and so on) Based on the theory, I expected the result will be (web server 1 -> web server 1 -> web server 1, and so on)
So, why is the pending request counting algorithm didn't work as expected?
NOTE:
Upvotes: 0
Views: 1095
Reputation:
I don't understand why you expect a different behavior? From the documentation:
A new request is automatically assigned to the worker with the lowest number of active requests.
In the case of multiple least-busy workers, the statistics (and weightings) used by the Request Counting method are used to break the tie. Over time, the distribution of work will come to resemble that characteristic of byrequests.
As long as your servers have similar work to do, behavior should be identical as with byrequests. It's just when some servers start to get a lot of requests that take time, they start to get skipped so that other servers get that traffic.
That's my understanding of it.
Upvotes: 0
Reputation: 5225
Just because a single server can process all the requests doesn't mean it should. If one server would process most of the requests, it would wear out to failure much faster than others, and that's generally not a desired condition. Such a strategy also imposes reliability risks: i.e., you could have the "server 3" unnoticedly misconfigured, just until the system load raises high enough to put it into the game — and it will fail right at the critical moment.
Upvotes: 0