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

Add explicit per-namespace rate limit to schedules #3838

Merged
merged 5 commits into from
Jan 26, 2023
Merged

Conversation

dnr
Copy link
Member

@dnr dnr commented Jan 25, 2023

What changed?
Add explicit per-namespace rate limit to schedule start workflow actions.

Why?
Server operators might like to be able to limit the number of workflows started by schedules, to avoid overloading the rest of the cluster if the feature is misused.

How did you test it?
New integration test

Potential risks

Is hotfix candidate?

@dnr dnr requested a review from a team as a code owner January 25, 2023 03:37
func (s *workerComponent) activities(name namespace.Name, id namespace.ID) *activities {
func (s *workerComponent) activities(name namespace.Name, id namespace.ID, workerFactor float64) *activities {
localRPS := func() float64 {
return s.globalNSStartWorkflowRPS(name.String()) * workerFactor
Copy link
Member

Choose a reason for hiding this comment

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

Can we not introduce this workerFactor? I think it might be more clear here to calculate it as:
localRPS = multiplicity * (globalRPS / totalWorkerCount).

Copy link
Member Author

Choose a reason for hiding this comment

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

So you want to pass in multiplicity and total and do the division inside here? I guess that's fine too

}
for {
var res schedspb.StartWorkflowResponse
err := workflow.ExecuteLocalActivity(ctx, s.a.StartWorkflow, req).Get(s.ctx, &res)
Copy link
Member

Choose a reason for hiding this comment

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

if this keep happening, will this blow up the history size?

Copy link
Member Author

Choose a reason for hiding this comment

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

It happens at most once, that's what CompletedRateLimitSleep is for

@dnr dnr merged commit 7e89af4 into temporalio:master Jan 26, 2023
@dnr dnr deleted the sched36 branch January 26, 2023 07:11
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.

2 participants