Queuing requests when all servers busy

From: Brian Candler <B.Candler_at_pobox.com>
Date: Thu, 27 Mar 2008 16:28:46 +0000

I have been doing some tests with the following configuration:

                           ,-------> [mongrel1]
              -----> [Pen]
                           `-------> [mongrel2]

This is running under Linux (CentOS 4.5) with pen-0.17.2

I am running pen with:

    /usr/bin/pen -F /etc/pen.d/testapp.conf -u nobody
                 -p /var/run/pen/testapp.pid
                 -C -e

and /etc/pen.d/testapp.conf contains:

    no http
    server 0 address port 10001 max 1 hard 1
    server 1 address port 10002 max 1 hard 1
    web_stats /u/apps/admin/shared/tmp/pen/testapp.html

Notice I have set 'max 1 hard 1' to ensure that pen will always choose an
idle mongrel rather than one which is busy handling a request. This is
because mongrel+Rails is single threaded, only handling a single request at
a time. If a second one comes in it will wait behind the first.

Now, what I'm finding is that if I make more than two concurrent connections
to pen, the third connection is accepted but immediately dropped.
drops the third connection immediately, and logs

    "Couldn't find a server for client"

What I would like instead is for it to accept the connection, then wait
until a backend server becomes free before connecting to it.

Can this be done with pen? If not, do you have any suggestions for
alternative solutions?


Brian Candler.

P.S. The final solution have an Apache front-end in front of pen, to handle
mod_auth_xxx, static content, and SSL. This means that pen sees each
connection from, so I don't think the per-client tracking helps.
This is why I have set "roundrobin". Also, Apache already adds an
X-Forwarded-For header, hence "no http".
Received on Thu Mar 27 2008 - 17:28:58 CET

This archive was generated by hypermail 2.2.0 : Thu Mar 27 2008 - 17:29:00 CET