3 ms·
I'm quite befuddled by this article, because the perspective is pretty exactly 180° of what I'm used to. I don't (try to) control or manage backpressure. Back
by eqvinox 5y ago
I'm quite befuddled by this article, because the perspective is pretty exactly 180° of what I'm used to.
I don't (try to) control or manage backpressure. Backpressure controls - or rather, steers - me/my code. Getting backpressure right is massively important and frequently under-considered design aspect.
The most significant thing to understand IMHO is that you need to look at backpressure in the context of the larger system. More concretely, you need to ask yourself "is this telling me that another task should run right now"? Both for synchronously driven sources (e.g. blocking write() syscall) as well as asynchronously driven sources (event loop with "can send" flag), you need to make sure you (a) don't block other progress (held locks on DB) and (b) actually pull up other tasks (particularly important for partially-asynchronous code).
And this leads straight to the single most impactful design/scaling decision for these systems: is the source maintaining its outbound scheduling at a high enough level? This is best clarified with an example: say you have a key/value store that sends out change notifications per key. Does your application need every single step, or just the most recent value? And if it's the latter: you shouldn't even have a "true" queue! Instead, the code needs to track which keys are pending for which receiver, and whenever the receiver can accept data, it needs to send the most recent data for pending keys. This is the difference between an unbounded queue and a bounded by number of keys queue. The former can fail disastrously, the latter will just start lagging but once it reaches the worst case, it just stays there.
> For example, if someone says: “I made this new library with built-in backpressure…” they probably mean it somehow helps you manage backpressure, not that it actually intrinsically is the cause of it. Backpressure is not “desirable” except when it’s inescapable and you want to protect something else from receiving it.
… and this really encapsulates my disagreement. Backpressure is absolutely desirable. I want my libraries to provide me with backpressure when there is reason to do so, and do it in a way I can actually "consume" the backpressure!
And lastly:
> Backpressure Strategies: control, buffer, drop
"buffer" and "drop" are in most cases just bugs. And very hard to debug & track down, due to their load dependency.
- specialist 5y agoMy last team (3 years ago) mostly used nodejs. Our services would tip over under load. Explaining backpressure was a lot of work. With zero reward. Less so for fixing it. I was bemused that the entire nodejs ecosystem, community was oblivious to this issue. Hard to take any of it seriously.