How it works...

Backpressure is a critical characteristic of a well-implemented stream processor. When using the imperative programming paradigm, such as looping over the array of records in a batch, the downstream target system could easily be overwhelmed because the loop will process the records as fast as it can without regard for the throughput capacity of the target system. Alternatively, the Functional Reactive Programming (FRP) paradigm, with a library such as Highland.js (https://highlandjs.org) or RxJS (https://github.com/ReactiveX/rxjs), provides a natural backpressure, because data is pulled downstream only as fast as the downstream steps are able to complete their tasks. For example, an external system that has low throughput ...

Get JavaScript Cloud Native Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.