TRANSPORT LAB · ORDER · ACCOUNT · RECOVER

HTTP/2 multiplexing: one connection, two credit limits

Schedule actual DATA byte counts while tracking each stream’s credit and the shared connection window.

Deterministic teaching trace · no network calls

Exact computed state

Inspect timestamps, decisions and accounting

Multiplexing is not unlimited parallel bandwidth

The fixture opens up to four client-initiated streams with identifiers one, three, five and seven. Their payload sizes are twelve, six, ten and eight kibibytes. One connection transmits at most one DATA frame per scheduler slot, with at most 4096 payload bytes in that frame. A frame must fit both the selected stream’s remaining window and the shared connection window. Sending deducts its byte count from both. The diagram shows the actual serialized frame order, while the per-stream bars show cumulative bytes sent rather than independent decorative particles.

Control sending and consumption

Concurrent streams chooses how many fixed payloads participate. Initial connection window sets shared DATA credit; Initial stream window sets each stream’s separate credit. These deliberately tiny values are teaching settings, not HTTP/2 defaults. Consumption delay schedules when a receiver consumes a sent frame and returns stream credit. Return connection credit determines whether that same consumption also replenishes the connection window. Stop consumption on stream one withholds both consumption and credit return for that stream. Local scheduling policy selects round-robin among eligible streams or the lowest-numbered eligible stream first; neither policy is mandated by HTTP/2. Every setting rebuilds and pauses the fixture.

Distinguish fairness from flow control

With defaults, the first four DATA frames use streams one, three, five and seven in order. Choose lowest-numbered-first scheduling and compare: stream one can send successive frames while it remains eligible. Restore defaults, set the connection window to four kibibytes and disable connection-credit return. Exactly 4096 bytes can be sent before the connection blocks, even though other streams still have their own credit. Re-enable connection updates and observe sending resume after consumption. Set stream credit to one kibibyte to force smaller frames. Stop consumption on stream one and inspect how its unreplenished credit and the shared window constrain subsequent progress.

Read the accounting at each step

Play maps the bounded scheduler record to sixty inspection seconds. Pause freezes it, Step adds one inspection second, Restart rewinds, Speed changes inspection pace and Inspect time selects a scheduler state. Slot minus one is the untouched initial state. Restore defaults resets all controls. The inspector reports exact frame offsets, byte counts, credits and scheduled credit returns. Sending complete means all payload bytes were sent and no consumption event remains scheduled; a deliberately stalled receiver may still have unconsumed bytes. Blocked means no eligible send and no future consumption can restore progress. This model excludes headers, padding, SETTINGS negotiation, control-frame bandwidth, TCP loss and real application scheduling. It illustrates DATA flow-control accounting, not a full HTTP/2 stack or throughput prediction.

Views are my own and do not represent any employer, past or present.

Search