kazuho / draft-kazuho-httpbis-priority

Other
6 stars 4 forks source link

Consider two frame type values to avoid wasting a byte #120

Closed ianswett closed 4 years ago

ianswett commented 4 years ago

Currently, we're using a byte to have a 1-bit value indicating whether the ID is a push ID. This also makes the framing a bit more complex to parse, since all other H3 frames contain only varints and blobs. We could solve the consistency problem by making it a varint with two valid values, but that's a bit odd to me.

I think it'd be simpler to have two frame types that are adjacent, one to indicate it's a Push ID and one to indicate it's a request Stream ID.

Admittedly, we're encoding a string as the value, so saving a byte doesn't seem that important, but it seems like a cleaner design to me.

LPardue commented 4 years ago

Having two frame types was the initial idea I had in mind but decided not to use in order provide some design slack. I'm happy to revisit / iterate things to tighten the slack but we should note the constraints and risk areas for change.

The design for PRIORITY_UPDATE assumes it is a reprioritization signal only sent on H3 control stream. That drives the need to refer to request or push by an ID.

The HTTP WG seem split on how the initial priority should be signalled. If it were to be a frame on the request stream, then we'd likely want a PRIORITY frame that can omit the ID, because that will waste bytes. This is how the pre-21 H3 frame worked, assigning 2 bits to express if the element ID was present. If using initial priority frames turns out to be preferred (not my preference fwiw), then you could define 3 frame types that achieve the same thing as reserving a byte and defining special meaning to bits.

I think the final design will be influenced by further developments in the process.

On Sat, Nov 23, 2019 at 7:04 PM ianswett notifications@github.com wrote:

Currently, we're using a byte to have a 1-bit value indicating whether the ID is a push ID. This also makes the framing a bit more complex to parse, since all other H3 frames contain only varints and blobs. We could solve the consistency problem by making it a varint with two valid values, but that's a bit odd to me.

I think it'd be simpler to have two frame types that are adjacent, one to indicate it's a Push ID and one to indicate it's a request Stream ID.

Admittedly, we're encoding a string as the value, so saving a byte doesn't seem that important, but it seems like a cleaner design to me.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kazuho/draft-kazuho-httpbis-priority/issues/120?email_source=notifications&email_token=ABSELNKN672U5QBOWOJOHX3QVF5DVA5CNFSM4JQ3O6M2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H3SPAWA, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSELNMQKEONVTVB2NY3D2DQVF5DVANCNFSM4JQ3O6MQ .

ianswett commented 4 years ago

Thanks Lucas, that makes sense. With the existing frame, you can specify an initial priority, with the caveat that the only guarantee it arrives immediately prior to the request is from how STREAM frames are bundled into packets. And it consumes an extra byte from being on the control stream.

It seems like the larger issue we should discuss is whether to allow this frame on the request stream, since that'll dictate some other choices. I'd like to allow that, but our frame bundling implementation is fairly good, so I don't think it's absolutely critical.

kazuho commented 4 years ago

I think that the issue is irrelevant to the discussion on if we should be using a frame to sending initial priorities. We need a PRIORITY_UPDATE frame sent on the control stream that can specify both a request stream that has already been closed and a push stream.

Going back to the how we introduced the current frame design in the prioirity draft, one of the reasons we have used a bit in the payload is that the old PRIORITY frame of H3 was designed that way (see https://github.com/kazuho/draft-kazuho-httpbis-priority/pull/51#issuecomment-548291692).

In IETF 106, we had a similar discussion IIRC with regard to the QUIC datagram extension, and the WG seemed to favor allowing extensions to reserve a couple of adjacent frame types instead of using bits in the payload. Based on that, I am incliend to changing our design to use two frame types values.

LPardue commented 4 years ago

I only partially agree that initial priority is irrelevant because, depending on how that discussion turns out, we could end up with wanting three frame types and it would seem sensible that the codepoints are contiguous.

The earliest codepoint that is available to HTTP/2 and HTTP/3 with enough space is 0xF, so you'd be looking at HTTP/3 frame types:

In order to make progress, we could shift the PRIORITY_UPDATE frame codepoint to 0x10, then reserve 0xF for a potential initial priority frame (thus punting the issue), and reserve 0x11 in HTTP/2 so that noone accidentally defines an extension that collides.

LPardue commented 4 years ago

I opened https://github.com/httpwg/http-extensions/issues/1096 to continue the discussion in the adopted draft.