HTTP/2.0 Max Frame Size

Osama Mazahir <OSAMAM@microsoft.com> Wed, 23 January 2013 07:56 UTC

Return-Path: <ietf-http-wg-request@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BE9DF21F8877 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 22 Jan 2013 23:56:58 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.599
X-Spam-Level:
X-Spam-Status: No, score=-10.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mit47RXgYu4L for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Tue, 22 Jan 2013 23:56:57 -0800 (PST)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id B3EB821F886C for <httpbisa-archive-bis2Juki@lists.ietf.org>; Tue, 22 Jan 2013 23:56:57 -0800 (PST)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1TxvBX-0003Aw-Km for ietf-http-wg-dist@listhub.w3.org; Wed, 23 Jan 2013 07:55:51 +0000
Resent-Date: Wed, 23 Jan 2013 07:55:51 +0000
Resent-Message-Id: <E1TxvBX-0003Aw-Km@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <OSAMAM@microsoft.com>) id 1TxvBR-0003AD-Pb for ietf-http-wg@listhub.w3.org; Wed, 23 Jan 2013 07:55:45 +0000
Received: from na01-bl2-obe.ptr.protection.outlook.com ([65.55.169.27] helo=na01-bl2-obe.outbound.protection.outlook.com) by maggie.w3.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from <OSAMAM@microsoft.com>) id 1TxvBQ-0001Ex-R5 for ietf-http-wg@w3.org; Wed, 23 Jan 2013 07:55:45 +0000
Received: from BL2FFO11FD009.protection.gbl (10.173.161.200) by BL2FFO11HUB036.protection.gbl (10.173.161.116) with Microsoft SMTP Server (TLS) id 15.0.596.13; Wed, 23 Jan 2013 07:54:58 +0000
Received: from TK5EX14HUBC101.redmond.corp.microsoft.com (131.107.125.37) by BL2FFO11FD009.mail.protection.outlook.com (10.173.161.15) with Microsoft SMTP Server (TLS) id 15.0.596.13 via Frontend Transport; Wed, 23 Jan 2013 07:54:58 +0000
Received: from TK5EX14MLTW652.wingroup.windeploy.ntdev.microsoft.com (157.54.71.68) by TK5EX14HUBC101.redmond.corp.microsoft.com (157.54.7.153) with Microsoft SMTP Server (TLS) id 14.2.318.3; Wed, 23 Jan 2013 07:54:47 +0000
Received: from TK5EX14MLTW651.wingroup.windeploy.ntdev.microsoft.com (157.54.71.39) by TK5EX14MLTW652.wingroup.windeploy.ntdev.microsoft.com (157.54.71.68) with Microsoft SMTP Server (TLS) id 14.2.328.11; Tue, 22 Jan 2013 23:54:46 -0800
Received: from TK5EX14MBXW601.wingroup.windeploy.ntdev.microsoft.com ([169.254.1.23]) by TK5EX14MLTW651.wingroup.windeploy.ntdev.microsoft.com ([157.54.71.39]) with mapi id 14.02.0328.011; Tue, 22 Jan 2013 23:54:46 -0800
From: Osama Mazahir <OSAMAM@microsoft.com>
To: "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
Thread-Topic: HTTP/2.0 Max Frame Size
Thread-Index: Ac35Mb89tYr74c3hRcyDFP7mQhStEA==
Date: Wed, 23 Jan 2013 07:54:46 +0000
Message-ID: <B33F11E188FEAB49A7FAF38BAB08A2C001CC12B9@TK5EX14MBXW601.wingroup.windeploy.ntdev.microsoft.com>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [157.54.51.43]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Forefront-Antispam-Report: CIP:131.107.125.37; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(189002)(199002)(52054001)(47736001)(50466001)(33656001)(23726001)(49866001)(53806001)(16406001)(4396001)(59766001)(77982001)(54356001)(54316002)(47776002)(31966008)(16796002)(44976002)(46102001)(74662001)(74502001)(47446002)(56816002)(76482001)(56776001)(46406002)(79102001)(55846006)(50986001)(47976001)(51856001)(6816006); DIR:OUT; SFP:; SCL:1; SRVR:BL2FFO11HUB036; H:TK5EX14HUBC101.redmond.corp.microsoft.com; RD:; MX:1; A:1; LANG:en;
X-OriginatorOrg: microsoft.onmicrosoft.com
X-Forefront-PRVS: 073515755F
Received-SPF: pass client-ip=65.55.169.27; envelope-from=OSAMAM@microsoft.com; helo=na01-bl2-obe.outbound.protection.outlook.com
X-W3C-Hub-Spam-Status: No, score=-0.0
X-W3C-Hub-Spam-Report: RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001
X-W3C-Scan-Sig: maggie.w3.org 1TxvBQ-0001Ex-R5 d87162718906cfe19eeb001bb8b27ab3
X-Original-To: ietf-http-wg@w3.org
Subject: HTTP/2.0 Max Frame Size
Archived-At: <http://www.w3.org/mid/B33F11E188FEAB49A7FAF38BAB08A2C001CC12B9@TK5EX14MBXW601.wingroup.windeploy.ntdev.microsoft.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/16127
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

Hello,

The current draft (http2-01) says the following about control frame sizes:
      Note that full length control frames (16MB) can be large for
      implementations running on resource-limited hardware.  In such
      cases, implementations MAY limit the maximum length frame
      supported.  However, all implementations MUST be able to receive
      control frames of at least 8192 octets in length.

What are your thoughts on having small control frames (e.g. control frames cannot exceed NNN octets and all implementations must be able to handle frames of NNN octets)?


Max Frame Size Discovery
========================================
As currently written, there is no way for an endpoint to know upfront the maximum frame size the other side will accept.  So if an endpoint emits a SYN_STREAM, for example, and gets back a RST_STREAM(FRAME_TOO_LARGE) then it either gives up or retries with a smaller SYN_STREAM (e.g. by initial splitting the initial Name/Value Header Block into multiple HEADERS frames).  I assume implementations will not get that crazy and instead just give up; not to mention that automatically retrying non-idempotent operations is badness.  Paranoid implementations may split their Name/Value Header Block, from the get-go, into multiple HEADERS frame each less than 8192 octets.

I realize that current HTTP/1.1 implementations have limits on how big the headers can get, but I view that as a separate issue from max frame size.  That is, if an implementation rejects HTTP/1.1 requests that have more than 16KB of headers than the equivalent in HTTP/2.0 would be a 16KB limit enforcement after decompression of headers.

Some frames (e.g. SETTINGS) do not have a reply to indicate that the frame was too large.  It is unclear what an implementation may do which can lead to a mess of different implementations.

One way to deal with this ambiguity would be to have each endpoint advertise its max frame size.  Or keep it simple by the spec mandating the max frame size (e.g. maximum control frame size is 8192 octets).


Discrete Frame Processing
========================================
I suspect most implementations to receive and buffer, from the TCP socket, an entire frame before processing it.  This allows for clean separation between frame receiving and frame processing.  You usually want a full control frame before propagating the results up the stack.  Which means an implementation would have to buffer a 10MB, for example, control frame before acting on it.  Or code up more complex processing as part of the receiving logic so that it detects the "too large" frame, emits an error frame (if a type exists), and then puts the parser/receiver into drain mode to pull and drop, from the TCP socket, the remainder of the frame.