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

Engine flow control support #227

Merged
merged 3 commits into from
Nov 12, 2020
Merged

Engine flow control support #227

merged 3 commits into from
Nov 12, 2020

Conversation

vijaynalawade
Copy link
Contributor

What kind of change does this PR introduce? (check one with "x")

[] Bugfix
[x] Feature
[] Code style update (formatting, local variables)
[] Refactoring (no functional changes, no api changes)
[] Other... Please describe:

Fixes: #
#226
What is the current behavior?
Today, engine will simply accept as many events as possible(Direct Runner) or block trigger go-routines when worker queue is full(Pooled Runner). This could lead to a performance issue or even loss of events due to resource constrains like CPU and Memory or blocked workers(Pooled runner). This might also lead to engine crash.
What is the new behavior?
Added new interface that Trigger implementations can implement to support pause/resume. Also added a mechanism that can force pausing/resuming of triggers. The flow control policies are in not scope of this PR.

@lixingwang
Copy link
Contributor

@vijaynalawade I am thining the controller should be app-specific, can we move it as an method of app. such as: app.SetController(defaultController) etc.

Users may don't need a controller for most cases. so can we add an env var to control it? by default, there is no controller
@mellistibco thoughts?

controller.triggers[id] = t
}
}
go controller.startController()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you have no flow control aware triggers then why start the controller?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mellistibco Fixed in latest update.

// Resume triggers
log.RootLogger().Info("Resuming Triggers...")
for _, trg := range c.triggers {
err := trg.Resume()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug log to say which triggers have been resumed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mellistibco Fixed in latest update.

@mellistibco
Copy link
Member

agree with @lixingwang. I think in most scenarios the user will not use this...

@vijaynalawade
Copy link
Contributor Author

@mellistibco @lixingwang Please review latest update.

Copy link
Contributor

@lixingwang lixingwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@lixingwang lixingwang merged commit 8202430 into master Nov 12, 2020
@vijaynalawade vijaynalawade deleted the engine-flow-control-support branch November 12, 2021 07:31
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

Successfully merging this pull request may close these issues.

4 participants