Backpressure in Long-Lived HTTP/2 Streams
When multiplexing telemetry pipelines over a single HTTP/2 connection, naive buffering inside
application handlers rapidly exhausts per-isolate memory budgets. Using Web Streams API
ReadableStream backpressure signals allows producers to pause automatically whenever
the downstream consumer window closes.
const stream = new ReadableStream({
async pull(controller) {
const chunk = await upstream.next();
if (chunk.done) controller.close();
else controller.enqueue(chunk.value);
}
});