Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back pressure in Process API #581

Open
bergie opened this issue Nov 17, 2017 · 3 comments
Open

Back pressure in Process API #581

bergie opened this issue Nov 17, 2017 · 3 comments
Milestone

Comments

@bergie
Copy link
Member

bergie commented Nov 17, 2017

There are many situations where you want to throttle component's activity level. Examples could be rate limited API calls, or amount of files you can open simultaneously.

In the legacy AsyncComponent implementation we had support for a load outport, where the component would send its current load. Then you could use a component like flow/Throttle in front of the component to prevent new jobs being triggered before the component has finished previous ones, like:

# Only allow max 100 directory reads to happen at same time
'100' -> MAX ThrottleDir(flow/Throttle)
Directory OUT -> IN ThrottleDir OUT -> SOURCE Dir(filesystem/ReadDir)
Dir LOAD -> LOAD ThrottleDir

Another concept that has been used in various FBP systems is "back pressure" where an downstream component can tell its upstream "don't send me more data".

With backpressure, one question is how the max numbers of jobs for a component would be configured on graph level. We have several mechanisms that could be used, like control inports or node/edge metadata.

@bergie
Copy link
Member Author

bergie commented Mar 14, 2018

Based on a chat with @trustmaster today, the way forward would be to allow graph designers to add a load port to component instances. If such port is present, component activation/deactivation would send current load out to that port. Throttling logic can then be implemented as another component on the graph level.

Depends on #594

@bergie bergie changed the title Figure out a way to do throttling with Process API Back pressure in Process API Dec 29, 2020
@bergie bergie added this to the NoFlo 2.0 milestone Dec 29, 2020
@bergie
Copy link
Member Author

bergie commented Dec 29, 2020

Actually, much nicer to properly implement back pressure in NoFlo than doing “load” ports. Buffer size can be handled via edge metadata (see “connection capabilities in noflo/noflo-ui#370).

Quick ideas:

  • we can make a Promisified sending method that checks if connection is ready to receive and waits otherwise
  • for components that don’t use this, we can probably control their activation when their downstream is blocked, and only activate when downstream is ready to receive again

@linonetwo
Copy link
Contributor

Use backpressure to prevent new input from being processed until the current conversation is done. #1042

Please review this guide, I'm not sure if ChatGPT knows your implementation well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants