Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A1EC6110E3 for ; Tue, 9 Sep 2014 19:20:23 +0000 (UTC) Received: (qmail 76606 invoked by uid 500); 9 Sep 2014 19:20:23 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 76535 invoked by uid 500); 9 Sep 2014 19:20:23 -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 76524 invoked by uid 99); 9 Sep 2014 19:20:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2014 19:20:23 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NEUTRAL,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [195.245.230.175] (HELO mail1.bemta3.messagelabs.com) (195.245.230.175) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2014 19:20:15 +0000 Received: from [85.158.138.179:22496] by server-15.bemta-3.messagelabs.com id A2/B1-01573-6D25F045; Tue, 09 Sep 2014 19:19:50 +0000 X-Env-Sender: ruediger.pluem@vodafone.com X-Msg-Ref: server-7.tower-169.messagelabs.com!1410290389!11098767!1 X-Originating-IP: [195.232.224.70] X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4759 invoked from network); 9 Sep 2014 19:19:50 -0000 Received: from mailout01.vodafone.com (HELO mailout01.vodafone.com) (195.232.224.70) by server-7.tower-169.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 9 Sep 2014 19:19:50 -0000 Received: from mailint01.vodafone.com (localhost [127.0.0.1]) by mailout01.vodafone.com (Postfix) with ESMTP id CF0FC2E0214 for ; Tue, 9 Sep 2014 21:19:49 +0200 (CEST) Received: from VOEXC01W.internal.vodafone.com (voexc01w.dc-ratingen.de [145.230.101.21]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mailint01.vodafone.com (Postfix) with ESMTPS id C30B32E01D3 for ; Tue, 9 Sep 2014 21:19:49 +0200 (CEST) Received: from VOEXC08W.internal.vodafone.com (145.230.101.28) by VOEXC01W.internal.vodafone.com (145.230.101.21) with Microsoft SMTP Server (TLS) id 14.3.181.6; Tue, 9 Sep 2014 21:19:49 +0200 Received: from VOEXM10W.internal.vodafone.com ([169.254.2.80]) by voexc08w.internal.vodafone.com ([145.230.101.28]) with mapi id 14.03.0181.006; Tue, 9 Sep 2014 21:19:49 +0200 From: =?iso-8859-1?Q?Pl=FCm=2C_R=FCdiger=2C_Vodafone_Group?= To: "dev@httpd.apache.org" Subject: AW: [Patch] Async write completion for the full connection filter stack Thread-Topic: [Patch] Async write completion for the full connection filter stack Thread-Index: AQHPywTEYoJdm0/EIEupsHVqM77tu5v3IDYAgAAbqQCAAAZmAIAAMo4AgAFdlwCAAFp7kA== Date: Tue, 9 Sep 2014 19:19:48 +0000 Message-ID: References: <715A3AE8-8015-4537-943F-A34E0E2A76F7@sharp.fm> <540DFB30.6050700@apache.org> <2F3B060C-E383-407F-A24C-7F026AD3CA81@sharp.fm> In-Reply-To: <2F3B060C-E383-407F-A24C-7F026AD3CA81@sharp.fm> Accept-Language: en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org > -----Urspr=FCngliche Nachricht----- > Von: Graham Leggett [mailto:minfrin@sharp.fm] > Gesendet: Dienstag, 9. September 2014 17:45 > An: dev@httpd.apache.org > Betreff: Re: [Patch] Async write completion for the full connection > filter stack >=20 > On 08 Sep 2014, at 8:53 PM, Ruediger Pluem wrote: >=20 > > Wouldn't it make more sense instead of using an empty brigade to > create yet another metabucket that signals write > > completion? It could also contain information how much data to send > down the chain for single filters if they e.g. send > > heap or transient buckets. Otherwise how should they know? > > If you have a filter that has a large file bucket set aside and it > does transform it e.g. to a heap bucket during it's > > processing because it changes data on it I guess it doesn't make sense > if it does send all stuff once it gets triggered > > for write completion as we would end up in a blocking write then in > the core filter. But if it knows how much is left in > > the core filter buffer it could try to just sent this and avoid thus > blocking writes. And if there is no room left in > > the buffer or if what is left is too small for the filter to operate > on it, the filter could just pass the bucket down > > the chain and if it would end up in the core output filter, the core > output filter would just try to write what it has > > buffered. >=20 > I spent a lot of time going down this path of having a dedicated > metabucket, and quickly got bogged down in complexity. The key problem > was "what does a filter actually do when you get one", it was unclear Don't we have the same problem with an empty brigade? Some filters are not = going to handle it as we expect. Hence the additional logic in ap_pass_brigade. I guess the minimum behavior we need to get from every filter is to ignore = and pass on. > and it made my head bleed. That makes life hard for module authors and > that is bad. As I recall there were also broken filters out there that > only knew about FLUSH and EOS buckets (eg ap_http_chunk_filter()). We already have additional metabuckets like error buckets or EOR. So I don't see an issue creating a new one. Any filter not passing a meta b= ucket that is does not understand or even try to process it is simply broken.=20 >=20 > The problem we're trying to solve is one of starvation - no filters can > set aside data for later (except core via the NULL hack), because there > is no guarantee that they'll ever be called again later. You have to > write it now, or potentially write it never. The start of the solution > is ensure filters aren't starved: if you have data in the output filters > - and obviously you have no idea which filters have setaside data - you > need a way to wake them all up. The simplest and least disruptive way is > to pass them all an empty brigade, job done. We've got precedent for > this - we've been sending NULL to the core filter to achieve the same But this is *our* filter and it will not hit any custom filters. So we can do this kind of hacky game here. > thing, we want something that works with any filter. Yes, and this is the reason why I still believe a meta bucket is better. >=20 > The second part of the problem is filters biting off more than they can > chew. Example: give mod_ssl a 1GB file bucket and mod_ssl won't yield > until that entire 1GB file has been sent for the reason (now solved) > above. The next step to enable write completion is to teach filters like > mod_ssl to yield when handling large quantities of data. >=20 > The core filter has an algorithm to yield, including various checks for > flow control and sanity with respect to file handles. If a variant of > this algorithm could be exposed generically and made available to > critical filters like mod_ssl, we'll crack write completion. See my other post. I proposed some kind of advisor API that tells a filter how much it should write to avoid buffering too much and consuming too much memory and how much it could write to likely avoid a blocking write. As this will not be always accurate I call it advisor API. Regards R=FCdiger