官术网_书友最值得收藏!

Backpressure

One of the important concepts that you should know about in Reactive Programming is backpressure. It significantly improves Reactive Programming over the traditional code. What exactly is it? It is considered as one of the non-blocking regulatory mechanisms used to send asynchronous messages or feedback to the source of a stream for load regulation. Communication back to the stream sender could possibly be a request or alert to stop. However, it could also be about the receiver's intent to process more messages. The communication back to the sender has to be non-blocking. This is important.

Consider the situation where observables (source of an event) send out the data at a higher rate than the subscribers can actually handle. In this case, the subscribers would be in a stress condition, unable to handle the flow properly, and there is a high chance the system would behave unexpectedly. To avoid this situation, there must be some arrangement for conveying the speed at which the subscribers can consume the data, back to the observables.

The mechanism for notifying the source of the event saying, Hey, I am under pressure, so don't send a further message as I can consume X amount of messages at a particular time, is called backpressureIn the absence of this, the system may keep increasing the buffer size until it runs out of memory error. Backpressure is required when emission happens at a faster rate than consumption. It will make sure the system remains resilient under the load and will provide information that is used to make the decision, whether the system needs additional resources or not. 

主站蜘蛛池模板: 安塞县| 益阳市| 都匀市| 临潭县| 昌黎县| 玉田县| 社旗县| 沈阳市| 巴里| 阿合奇县| 丹寨县| 余干县| 德江县| 涞源县| 化州市| 鄂伦春自治旗| 琼中| 广宁县| 大厂| 德兴市| 邛崃市| 岳普湖县| 鸡东县| 沁源县| 连平县| 麻江县| 边坝县| 泰来县| 大安市| 信丰县| 台州市| 石门县| 峡江县| 孝昌县| 汕尾市| 龙里县| 来宾市| 明溪县| 疏附县| 大渡口区| 彝良县|