-
Notifications
You must be signed in to change notification settings - Fork 762
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
Batch operation rate limit #4941
Conversation
4ffb894
to
20977ea
Compare
@@ -45,7 +45,6 @@ type activitiesSuite struct { | |||
testsuite.WorkflowTestSuite | |||
|
|||
controller *gomock.Controller | |||
env *testsuite.TestWorkflowEnvironment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused
fca2cc2
to
8fed2d0
Compare
8fed2d0
to
7c05712
Compare
efbf5b5
to
7fddbfe
Compare
func (a *activities) getOperationRPS(requestedRPS float64) float64 { | ||
maxRPS := float64(a.rps(a.namespace.String())) | ||
if requestedRPS <= 0 || requestedRPS > maxRPS { | ||
return maxRPS | ||
} | ||
return rps | ||
return requestedRPS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main change; all others are just cosmetic (making fields private, fixing up formatting and comments etc.)
@@ -43,7 +43,7 @@ require ( | |||
go.opentelemetry.io/otel/metric v1.19.0 | |||
go.opentelemetry.io/otel/sdk v1.19.0 | |||
go.opentelemetry.io/otel/sdk/metric v1.19.0 | |||
go.temporal.io/api v1.24.1-0.20231003165936-bb03061759c8 | |||
go.temporal.io/api v1.25.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgraded to new API version to pull in the max_operations_per_second
field.
0734e72
to
575c3ce
Compare
RPS int | ||
// RPS sets the requests-per-second limit for the batch. | ||
// The default (and max) is defined by `worker.BatcherRPS` in the dynamic config. | ||
RPS float64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was effectively unused before.
575c3ce
to
739e557
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are there so many deletions? 😕
## What changed? Adding back one line that was accidentally removed from #4941 after it was merged. Line added originally: https://github.com/temporalio/temporal/pull/4941/files#diff-c9a59445e489bd70346630f2773ad69e1723b2298fadbae50ff5c1a424917e1cR3468 ## Why? <!-- Tell your future self why have you made these changes --> ## How did you test it? <!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? --> ## Potential risks <!-- Assuming the worst case, what can be broken when deploying this change to production? --> ## Is hotfix candidate? No. The code will still work since we ignore it when `requestedRPS` is zero: ``` if requestedRPS <= 0 || requestedRPS > maxRPS { return maxRPS } ```
## What changed? Adding back one line that was accidentally removed from #4941 after it was merged. Line added originally: https://github.com/temporalio/temporal/pull/4941/files#diff-c9a59445e489bd70346630f2773ad69e1723b2298fadbae50ff5c1a424917e1cR3468 ## Why? <!-- Tell your future self why have you made these changes --> ## How did you test it? <!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? --> ## Potential risks <!-- Assuming the worst case, what can be broken when deploying this change to production? --> ## Is hotfix candidate? No. The code will still work since we ignore it when `requestedRPS` is zero: ``` if requestedRPS <= 0 || requestedRPS > maxRPS { return maxRPS } ```
What changed?
Allow rate limiting a batch operation. Fixes #4926.
Why?
Batch operations are run server side and may effect millions of executions, this in turn may overload workers and disrupt normal operations.
How did you test it?
I started the Server locally and initiated a batch operation from the CLI (CLI changes be found here):
Potential risks
Rate limiting to be incorrect and slow down processing or disrupt cluster.
Is hotfix candidate?
No