httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <>
Subject Re: question about keepalive and child processes (Apache/prefork 2.2.3)
Date Tue, 20 Feb 2007 17:30:16 GMT
On Sun, Feb 11, 2007 at 11:14:59AM -0500, Bill Erickson wrote:
> I'm developing a Perl module for Apache2, and while I was testing keepalives
> on Apache2 (prefork, 2.2.3, default Debian package), I noticed that requests
> were being handled by different children, even though they were inside a
> single keepalive session.
> 1. Is this the expected behavior?
> 2. Is there any way to force apache to send all keepalive requests to the
> same child process?

Are you sure the client library you were using was actually using keepalives?
With all of the current Apache MPM architectures, all keepalives requests
will be handled by the same thread in the same process. Each time you
make a new TCP/IP connection, however, it will be processed by a new

> Basically, I'm trying to leverage keepalives to allow for multiple requests
> inside a single database transaction.  For that, the client needs to be able
> to communicate with the same child process throughout the transaction.

I can't see how this will work. Since keepalive connections are not
guaranteed to be supported by the server, and because the server can
close off a keepalive connection at any time (see the spec for details),
you can't assume that the entire multi-request transaction will be
complete before the server stops processing. In other words, if your
transaction requires 10 commands, you can't assume that the server
will allow you to send all 10 corresponding HTTP requests, or even more
than 1 per keepalive connection.

An alternative might be to build up the transaction data in some server-side
session state, and then when all the data is accumulated you can make one
transactional call to the database.


View raw message