Backpressure
Backpressure adjusts incoming data to the receiver’s processing capacity through signals to slow down or pause.
Backpressure is feedback from a busy receiver asking an upstream data source to send less data or pause. It lets a processing stage adjust incoming flow to its capacity.
In a fictional import, the source reads 120 records per second while the database processes 40. With constant rates and no discarded records, the backlog grows by 80 records per second. A larger buffer postpones the problem. Backpressure makes the source read more slowly or pause until processing catches up.
Passing a pause signal upstream
On a functioning Node.js writable stream, a false return value from .write() signals a pause before sending more chunks. The chunk already passed in is not sent again for that reason. More chunks can follow after drain; errors and closed streams need separate handling. The buffer threshold highWaterMark is not a hard limit on total memory use.
The signal helps only if upstream stages respect it and bound their own buffers. If the source cannot be slowed, the application also needs bounded admission and a defined overload response. Rate limiting sets an allowed request rate; backpressure responds to receiving capacity within the data flow.
Sources
Related terms
- Message queueA message queue buffers messages until a consumer takes them for processing.
- Rate limitingRate limiting caps how frequently a client may make requests under a defined rule.
- Cache stampedeA cache stampede occurs when concurrent cache misses trigger the same expensive calculation or data query repeatedly.
- Race conditionA result depends on the timing of overlapping accesses and can therefore be wrong.
- Memory leakMemory that is no longer needed stays allocated while the program runs.
- ConcurrencyOrganising multiple tasks so that their processing periods can overlap.
Your project with ASES
Describe your project to us. We will get back to you with an initial assessment.