fair load balancing?

Mark Smith smitty at gmail.com
Fri Jun 20 02:08:19 UTC 2008

> I'll admit I'm completely knew to Perlbal, but I don't understand how
> verify_backend will work here.
> I just ran Perlbal up last week, proxying http requests to Mongrel app
> servers.
> I had "SET verify_backend  = on" in my config file.
> I still saw long-requests blocking subsequent requests.
> Am I misunderstanding something?

verify_backend makes the process of connecting to a backend into this:

1) start TCP connection to backend
2) on accept, send an "OPTIONS *" request
3) on 200 OK response, put backend in the pool

The critical step is #2, and that's what makes this work.  Let's say
you have Apache setup to MaxClients of 20, this will happen:

* the first 20 requests come in, are assigned backends, and Perlbal
uses them because they responded to OPTIONS *
* the 21st connection Perlbal makes sits idle - beccause there is no
Apache process to serve it
* when one of the first 20 dies off, Apache will respond to the 21st,
and Perlbal spawns a new 21st

What ends up happening here is that Perlbal will use up exactly as
many MaxClients as you specify - and no more.  Since (I assume) you
have persistent connections to the backend, it works out perfectly.
You can adjust the load on a server by adjusting MaxClients.  Of
course, this does assume that on average, your requests are roughly
equal in how much processing power it takes.

I assume that Mongrel will let you do the same thing - specify how
many processes to serve requests with.  If they use the same behavior,
then this approach will work out just as well for you as it does for
Apache based systems.

Mark Smith / xb95
smitty at gmail.com

More information about the perlbal mailing list