Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 89374 invoked from network); 23 Feb 2007 23:53:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Feb 2007 23:53:23 -0000 Received: (qmail 91058 invoked by uid 500); 23 Feb 2007 23:53:31 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 91040 invoked by uid 500); 23 Feb 2007 23:53:31 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 91031 invoked by uid 99); 23 Feb 2007 23:53:31 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Feb 2007 15:53:31 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of billserickson@gmail.com designates 64.233.182.187 as permitted sender) Received: from [64.233.182.187] (HELO nf-out-0910.google.com) (64.233.182.187) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Feb 2007 15:53:20 -0800 Received: by nf-out-0910.google.com with SMTP id n28so994388nfc for ; Fri, 23 Feb 2007 15:52:59 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=PDx4PTthlPCRbHMAZsKeFsedlRhS0gglA0XhrldtXKkNlta/50D10DwRyyI+4z1OuddK/50I1VpsbFDsjNPAW0L7NWxWNgEBtYB3uyBB9mWGeg8rETt7fmdgmEL0mRmr5zCbwLhjh09Ki50XxoXeRWAXMjDLCfTMcMLOHZbjZyA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=MizNGcAaEROPTfL1uR+bSwBzvVeXIZ2JDt12e3TWom8zFoP0x80TQ4mIcWUeAqYAKuo7EXSCjMDpisUDepI57TVgIOouJhpMfm+HawH5itMNjhmA/nHuQ7WnlfbxRsC9XI6aCxI5HrJUOUxQU+SkveH83KyPgmJyuuRsfgj3YhE= Received: by 10.49.90.4 with SMTP id s4mr7094743nfl.1172274779210; Fri, 23 Feb 2007 15:52:59 -0800 (PST) Received: by 10.48.203.4 with HTTP; Fri, 23 Feb 2007 15:52:59 -0800 (PST) Message-ID: <5420af0b0702231552x228318e3v9a0fa9371e5e580c@mail.gmail.com> Date: Fri, 23 Feb 2007 18:52:59 -0500 From: "Bill Erickson" To: modules-dev@httpd.apache.org Subject: Re: question about keepalive and child processes (Apache/prefork 2.2.3) In-Reply-To: <20070220173016.GP12308@clove.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_71899_4610200.1172274779132" References: <5420af0b0702110814n599dd1e3mb508549af361e1b@mail.gmail.com> <20070220173016.GP12308@clove.org> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_71899_4610200.1172274779132 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2/20/07, Aaron Bannert wrote: > > 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 > thread/process. Yep, I was wrong. There was something in my environment that was causing the connections to close. Testing elsewhere gives me the behavior I was expecting. (Long story, but I was getting worried there for a bit...) > 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. Let's say I can guarantee persistent connections (previous problems notwithstanding). I administer the server. I write the application. I know Apache well enough to know why a persistent connection will be severed. Regardless of whether my application is portable (not my concern right now), is this just off-the-wall crazy? :) Are there any other obvious gotchas I'm missing? 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. Thanks for the excellent feedback. -bill ------=_Part_71899_4610200.1172274779132--