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 7663818156 for ; Tue, 15 Dec 2015 15:44:39 +0000 (UTC) Received: (qmail 74608 invoked by uid 500); 15 Dec 2015 15:44:39 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 74528 invoked by uid 500); 15 Dec 2015 15:44:38 -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 74518 invoked by uid 99); 15 Dec 2015 15:44:38 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Dec 2015 15:44:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 6D8A2C0D43 for ; Tue, 15 Dec 2015 15:44:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.655 X-Spam-Level: X-Spam-Status: No, score=-0.655 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RP_MATCHES_RCVD=-0.554, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=greenbytes.de header.b=llclIyUs; dkim=pass (1024-bit key) header.d=greenbytes.de header.b=llclIyUs Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id VVEJDgCzYa3a for ; Tue, 15 Dec 2015 15:44:36 +0000 (UTC) Received: from mail.greenbytes.de (mail.greenbytes.de [217.91.35.233]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 4080F2673A for ; Tue, 15 Dec 2015 15:44:36 +0000 (UTC) Received: by mail.greenbytes.de (Postfix, from userid 117) id 5C94915A08FC; Tue, 15 Dec 2015 16:44:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=greenbytes.de; s=mail; t=1450194268; bh=4u/Y5XhVDaNWnMWqiOMxCfyMEgKwiQgZt6PH7Cvl69c=; h=From:Subject:Date:To:From; b=llclIyUs81skLvkvQMqxhEUJXre/CrsyQzET4PonaEoOveLO8EW4IVGh2FXCgq3Me hwBvv+rG55u9EeJXFf2mrY1qmfuFi1DxhorMM+EKQ5rWEJI8XAsFmWwcnZBMRXE75T cVOSoeZ+Iie1mTfpEdst/H8YTCJ0QcfDuGqCFirQ= Received: from [192.168.1.150] (unknown [217.91.35.233]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mail.greenbytes.de (Postfix) with ESMTPSA id 2E17015A01A8 for ; Tue, 15 Dec 2015 16:44:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=greenbytes.de; s=mail; t=1450194268; bh=4u/Y5XhVDaNWnMWqiOMxCfyMEgKwiQgZt6PH7Cvl69c=; h=From:Subject:Date:To:From; b=llclIyUs81skLvkvQMqxhEUJXre/CrsyQzET4PonaEoOveLO8EW4IVGh2FXCgq3Me hwBvv+rG55u9EeJXFf2mrY1qmfuFi1DxhorMM+EKQ5rWEJI8XAsFmWwcnZBMRXE75T cVOSoeZ+Iie1mTfpEdst/H8YTCJ0QcfDuGqCFirQ= From: Stefan Eissing Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: async mpms + http2 Message-Id: <703ED97E-4B43-4AC1-94B1-2BB55893DBAC@greenbytes.de> Date: Tue, 15 Dec 2015 16:44:27 +0100 To: dev@httpd.apache.org Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) X-Mailer: Apple Mail (2.3112) I just committed a change in mod_http2 that will return idle connections = back to the mpm, expecting to be invoked again when new data arrives. I = learned quite something about event (have not looked much at motorz yet) = and am thinking about improvements. If knowledgeable people could give = me a hand here, I'd highly appreciate it. Observation 1: mapping conn_states As I understand it, the connection state model, as defined in = conn_state_e, enables asynchronous processing in two states: a. CONN_STATE_CHECK_REQUEST_LINE_READABLE, check read, invoke = ap_run_process_connection() on data b. CONN_STATE_WRITE_COMPLETION, check write, if data is still in out = filters An invocation of ap_run_process_connection() is expected to return, = usually in WRITE_COMPLETION state. Then any data is attempted to be = written. When this succeeds, the next state depends on secondary flags = such as c->aborted, c->keepalive and c->data_in_input_filters. HTTP/2 processing has one state where it fits into this model: when no = more streams are open. This is what is currently implemented in trunk.=20= However, there is another state in HTTP/2 processing, where a = BLOCK_READ is performed: flow control on streaming out responses. = Basically, the client has a window of n bytes, the server sends n = response bytes and then needs to wait for the client to increase the = window again. This would be a good time to resume processing back to the = mpm, and initially I did so. But that breaks under load. Under load, the event mpm feels free to close connections in certain = states - I think CONN_STATE_CHECK_REQUEST_LINE_READABLE. That is fine = for a HTTP/1 connection as it always is between requests here. But = HTTP/2 would also like to use read events, but unloading a child by = closing such connections is not the right thing to do. Is there a way mod_http2 can achieve this or do we need another flag = in conn_rec/cs? Observation 2: controlled close HTTP/2 would like to send out a last frame when closing a connection = in a controlled/timeout way. Do we need another hook for that? Something = like "pre_close_connection"? =20 Observation 3: timeouts a. If admins would like to have another Timeout for HTTP/2 = connections, they are currently stuck with configuring one Timeout which = goes to server_rec->timeout, right? For idle connections, clients = already try to keep it open longer. It would be nice to give admins a = choice here for different values based on the selected protocol. How to = best do this? b. Handling own timeouts: if I want, during processing the connection, = a different socket timeout, I can just set it using = apr_socket_timeout_set()? Shall I restore it back to server->timeout = before returning? c. What would be the best way to wait for a file description *and* = conditional event simultaneously? mod_http2 has now a sort of pool loop = with double backup timer for situations where it needs to watch both = client and backend processes. Cheers, Stefan