Closed Lukasa closed 1 year ago
To be clear, I think the interface to and public nature of HTTP2StreamMultiplexer
should remain: it just shouldn't be a ChannelHandler
any more.
This was done without breaking API across a handful of PRs: https://github.com/apple/swift-nio-http2/pull/377, https://github.com/apple/swift-nio-http2/pull/379, https://github.com/apple/swift-nio-http2/pull/380, https://github.com/apple/swift-nio-http2/pull/381, https://github.com/apple/swift-nio-http2/pull/382, https://github.com/apple/swift-nio-http2/pull/383, https://github.com/apple/swift-nio-http2/pull/384, https://github.com/apple/swift-nio-http2/pull/386.
In v2, we should bring the
HTTP2StreamMultiplexer
into theNIOHTTP2Handler
and integrate them together, rather than having them be separate channel handlers.While it's been a nice design idea to separate these out, the result of that change has been that we incur an expensive and very noisy interface between these two tightly-related classes. The
NIOHTTP2Handler
has to tell theHTTP2StreamMultiplexer
some metadata on almost every frame (flow control changes, which affect the sending and receiving of DATA and WINDOW_UPDATE frames, and stream state changes, which affect HEADERS, RST_STREAM, and GOAWAY: basically all the frames, then). This metadata requires an extra pipeline walk to communicate, leading to a load of needless ARC traffic and extra cost.Rather than incur that cost, we should smush these two together and take advantage of the fact that they are, in fact, tightly coupled. This should give us a nice performance win as well as a huge correctness boost.