Skip to content
Optimal Lab

Node.js · interactive

Streams and backpressure

The producer wants to write faster than the consumer can read. The high water mark is the buffer's limit. Cross it, and the producer pauses.

Producer

writes 8/tick

Buffer

5 / 10 bytes

Consumer

reads 3/tick

Flowing. Wrote 8, read 3, 5 bytes waiting.

Tick 1 of 8
  1. 1

    If the stream is flowing, the producer adds bytes to the buffer.

    wrote 8 this tick · 8 B/tick in the panel

  2. 2

  3. 3

  4. 4