[quicwg/base-drafts] Interleaved Stream IDs are awkward (#1430)

Mike Bishop <notifications@github.com> Fri, 08 June 2018 11:25 UTC

Return-Path: <noreply@github.com>
X-Original-To: quic-issues@ietfa.amsl.com
Delivered-To: quic-issues@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BE9E3130E79 for <quic-issues@ietfa.amsl.com>; Fri, 8 Jun 2018 04:25:31 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -8.01
X-Spam-Level:
X-Spam-Status: No, score=-8.01 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, T_DKIMWL_WL_HIGH=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=github.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nKOyWYH_6BD1 for <quic-issues@ietfa.amsl.com>; Fri, 8 Jun 2018 04:25:28 -0700 (PDT)
Received: from out-4.smtp.github.com (out-4.smtp.github.com [192.30.252.195]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5B5FA130E78 for <quic-issues@ietf.org>; Fri, 8 Jun 2018 04:25:28 -0700 (PDT)
Date: Fri, 08 Jun 2018 04:25:27 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1528457127; bh=PHVO0/tWrFKQVSq7nXEHJHtvmq7ZfEAAV3h6ZPYEtuA=; h=Date:From:Reply-To:To:Cc:Subject:List-ID:List-Archive:List-Post: List-Unsubscribe:From; b=XG873M6JZtibjqjt5wgEQkUnrvbfAixkJ52P8bud9DOroBhVcbE4RrDDgisI7YE8L KASKqbxaTBKDWfgiDV9SJcLqLDv5xoPGvcNw7mtU3bzq2AA5um+dQnPSsoBUUot0G0 8/843JZ0OerRk7ls/fB5p8UymRRW3OyKLe+/RuSQ=
From: Mike Bishop <notifications@github.com>
Reply-To: quicwg/base-drafts <reply+0166e4abbf1eecfaecdad2cc7b5e7c2346eb61bf168127e292cf00000001173229a792a169ce13b4e093@reply.github.com>
To: quicwg/base-drafts <base-drafts@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Message-ID: <quicwg/base-drafts/issues/1430@github.com>
Subject: [quicwg/base-drafts] Interleaved Stream IDs are awkward (#1430)
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="--==_mimepart_5b1a67a77a6e7_b733fbf1fc8cf803211a9"; charset="UTF-8"
Content-Transfer-Encoding: 7bit
Precedence: list
X-GitHub-Sender: MikeBishop
X-GitHub-Recipient: quic-issues
X-GitHub-Reason: subscribed
X-Auto-Response-Suppress: All
X-GitHub-Recipient-Address: quic-issues@ietf.org
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic-issues/wOGrlrdx0eudWOzR_yh3rlWhZCU>
X-BeenThere: quic-issues@ietf.org
X-Mailman-Version: 2.1.26
List-Id: Notification list for GitHub issues related to the QUIC WG <quic-issues.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/quic-issues>, <mailto:quic-issues-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/quic-issues/>
List-Post: <mailto:quic-issues@ietf.org>
List-Help: <mailto:quic-issues-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/quic-issues>, <mailto:quic-issues-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 08 Jun 2018 11:25:32 -0000

In case we hadn't noticed before, at the Kista interim it became very clear how we all trip over the N/N+4 progression of stream IDs of the same type.  It's quite awkward.  As someone said, we'll all eventually get used to it, and so will the world... unless we don't have to.

It's possible to envision the lowest two bits of the Stream ID as flags which indicate the type, leaving the "real" ID as the upper bits.  However, by encoding them in the low bits of an integer, that becomes annoying to represent and work with easily.

If they were the high-order bits, that would be more convenient, but would of course blow out the varint encoding.  (Of course, two high-order bits of stream type and a 62-bit Stream ID fit nicely into a 64-bit variable assuming that implementations want to store them together once the varint is expanded.)  If varint could start mid-byte, that would also be an option, but that makes the varint parser more annoying.

The obvious solution, if we want to bite the bullet and go there, is to move the stream type being referenced into the frame type.  This was awkward when client-initiated bidirectional stream 0 was special, but now that crypto is moving to a special stream outside the Stream ID space, I think this transition makes more sense.  (Crypto is essentially a fifth type of stream with special properties: there can be only one, and most stream management frames don't apply to it.)

Besides making Stream IDs easier to keep track of, this resolves the inconsistency between `initial_max_(uni|bidi)_streams` and MAX_STREAM_ID -- the Stream ID and the count are the same thing, if the type is specified separately.  By reclaiming two bits per stream reference, this also saves a small number of bytes on the wire -- every STREAM, STOP_SENDING, RST_STREAM, etc. becomes a byte shorter for streams 16-63, 4096-16384, etc. of each stream type.  The same benefits will accrue to HTTP PRIORITY frames, where the stream type is already known from the fact that it's a stream carrying an HTTP request.

The biggest cost comes in combination with our decision to make frame types varint:  By spending two bits of frame type to indicate length and moving stream types into the type byte as well, there are only two frame types values left before we spill into a second byte, and we'll those for CRYPTO and CRYPTO_CLOSE.  (If we add something else and something has to spill over, I'd start with things that are sent only once per connection, like the *_CLOSE frames.)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/issues/1430