Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 52583 invoked from network); 26 Oct 2008 16:15:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2008 16:15:53 -0000 Received: (qmail 77404 invoked by uid 500); 26 Oct 2008 16:15:50 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 77327 invoked by uid 500); 26 Oct 2008 16:15:49 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 77318 invoked by uid 99); 26 Oct 2008 16:15:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Oct 2008 09:15:49 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.9] (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 26 Oct 2008 16:14:45 +0000 Received: (qmail 52437 invoked by uid 2161); 26 Oct 2008 16:15:25 -0000 Received: from [192.168.2.4] (euler.heimnetz.de [192.168.2.4]) by cerberus.heimnetz.de (Postfix on SuSE Linux 7.0 (i386)) with ESMTP id A487C1721C for ; Sun, 26 Oct 2008 17:13:21 +0100 (CET) Message-ID: <49049791.8030008@apache.org> Date: Sun, 26 Oct 2008 17:15:13 +0100 From: Ruediger Pluem User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.17) Gecko/20080829 SeaMonkey/1.1.12 MIME-Version: 1.0 To: dev@httpd.apache.org Subject: Re: strange usage pattern for child processes References: <20081015115548.GA9872@eilebrecht.net> <48F651DE.5060003@sharp.fm> <48F657A1.2070806@apache.org> <48F6752F.5030000@sharp.fm> <48F8EDEE.3080908@apache.org> <48F9E231.7060401@sharp.fm> <48F9F5C2.60209@apache.org> <48FA4590.2010106@sharp.fm> <48FB1826.4040607@apache.org> <48FB30CA.4060602@apache.org> <49033872.3020009@apache.org> <1D6916F2-7C97-403D-BF6A-7ED7A9BF346A@jaguNET.com> In-Reply-To: <1D6916F2-7C97-403D-BF6A-7ED7A9BF346A@jaguNET.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 10/26/2008 04:58 PM, Jim Jagielski wrote: > > On Oct 25, 2008, at 11:17 AM, Ruediger Pluem wrote: > >> >> >> On 10/19/2008 03:06 PM, Ruediger Pluem wrote: >> >>> Another maybe funny sidenote: Because of the way the read method on >>> socket buckets >>> work and the way the core input filter works, the ap_get_brigade call >>> when processing >>> the http body of the backend response in mod_proxy_http never returns >>> a brigade that >>> contains more then 8k of data no matter what you set for >>> ProxyIOBufferSize. >>> And this is the case since 2.0.x days. So the optimization was always >>> limited to >>> sending at most 8k and in this case the TCP buffer (the send buffer) >>> should have >>> fixed this in many cases. >> >> The following patch should fix the above thing. Comments? >> >> Index: server/core_filters.c >> =================================================================== >> --- server/core_filters.c (Revision 707744) >> +++ server/core_filters.c (Arbeitskopie) >> @@ -267,6 +267,35 @@ >> return APR_SUCCESS; >> } >> >> + /* Have we read as much data as we wanted (be greedy)? */ >> + if (len < readbytes) { >> + apr_size_t bucket_len; >> + >> + rv = APR_SUCCESS; >> + /* We already registered the data in e in len */ >> + e = APR_BUCKET_NEXT(e); >> + while ((len < readbytes) && (rv == APR_SUCCESS) >> + && (e != APR_BRIGADE_SENTINEL(ctx->b))) { >> + /* Check for the availability of buckets with known >> length */ >> + if (e->length != -1) { >> + len += e->length; >> + e = APR_BUCKET_NEXT(e); >> + continue; >> + } >> + /* >> + * Read from bucket, but non blocking. If there isn't >> any >> + * more data, well than this is fine as well, we will >> + * not wait for more since we already got some and we >> are >> + * only checking if there isn't more. >> + */ >> + rv = apr_bucket_read(e, &str, &bucket_len, >> APR_NONBLOCK_READ); >> + if (rv == APR_SUCCESS) { >> + len += bucket_len; >> + e = APR_BUCKET_NEXT(e); >> + } >> + } >> > > +1 for the concept, but I'm not sure I like the logic flow > of the continue. This is really an if/else so how about: Sure it is an if/else. I don't care very much whether it is continue of if/else. It just saved some indenting. So It can be in the way you proposed below. > > while ((len < readbytes) && (rv == APR_SUCCESS) > && (e != APR_BRIGADE_SENTINEL(ctx->b))) { > /* Check for the availability of buckets with known > length */ > if (e->length != -1) { > len += e->length; > e = APR_BUCKET_NEXT(e); > } else { > /* > * Read from bucket, but non blocking. If there > isn't any > * more data, well than this is fine as well, we will > * not wait for more since we already got some and > we are > * only checking if there isn't more. > */ > rv = apr_bucket_read(e, &str, &bucket_len, > APR_NONBLOCK_READ); > if (rv == APR_SUCCESS) { > len += bucket_len; > e = APR_BUCKET_NEXT(e); > } > } > } Regards RĂ¼diger