Skip to content

Replace sessions with mux and transport sessions #858

Closed

Description

@Keksoj

In the spirit of the HTTP2 milestone, we want to split the functioning of current sessions (who pass the traffic from front socket to back socket) into:

  • transport sessions (TCP)
  • mux (for multiplexing) sessions, which entails:
    • an HTTP "server" (HTTP1 or H2) on the front side
    • one or several HTTP "clients" (HTTP1 or H2) on the backend side (this is multiplexing)
    • routing and multiplexing logic

Screenshot from 2022-12-05 13-26-36


Update — 2026-04-24

Implemented on feat/h2-mux (PR #1209). The old Http<Front> protocol was replaced by a unified Mux<Front, L> session layer under lib/src/protocol/mux/ (~18k LOC across 13 files):

  • mod.rs — Mux<Front, L>, Connection enum, Endpoint trait, stream lifecycle, connect_to_backend.
  • connection.rs — Connection::H1(ConnectionH1) / Connection::H2(ConnectionH2) transport abstraction.
  • stream.rs — position-aware Stream with front/back kawa buffers shared between frontend and backend.
  • router.rs — backend routing with connect-rollback on failure.
  • h1.rs, h2.rs — per-protocol connection state machines.
  • Removed: old lib/src/protocol/h2/ module (1232 LOC) superseded by the mux layer.

Closes the "transport vs mux" split described in this issue. Suggest closing on merge of #1209.

Activity

  1. added this to the HTTP2 milestone on Dec 5, 2022
  2. Keksoj commented on Feb 13, 2023

    @Keksoj
    Author

    This layer architecture is outdated since this refactoring was enough:

    This refactoring makes the state machine of HTTP and HTTPS sessions responsible for handling the backends and for passing through the traffic.

    The multiplexing logic would be best implemented by adding a new State to the HTTP and HTTPS state machine. This new state could be called MuxHttp and would handle the splitting of HTTP2 traffic in several streams, and doing the passthrough and load balancing to several backends.

  3. FlorentinDUBOIS commented on Apr 27, 2026

    @FlorentinDUBOIS
    Collaborator

    Closed by #1209 — feat(h2): HTTP/2 support via unified Mux session layer.

    The Mux layer replaces the old Http<Front> protocol with a unified session that handles all four protocol combinations (H1↔H1, H1↔H2, H2↔H1, H2↔H2). Per-stream Kawa buffers decouple frontend and backend state — front and back sockets are no longer coupled through a shared BufferQueue. The original mux_v1 design from @Edemolis with @hcaumeil's H2 SETTINGS handshake was extracted, hardened, and completed for production in this PR.

    This was the parent issue of the HTTP/2 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions