-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Global RPS Control for Admin Batch Operation #10546
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,12 @@ import ( | |
| "go.temporal.io/server/api/adminservice/v1" | ||
| "go.temporal.io/server/common/dynamicconfig" | ||
| "go.temporal.io/server/common/log" | ||
| "go.temporal.io/server/common/log/tag" | ||
| "go.temporal.io/server/common/membership" | ||
| "go.temporal.io/server/common/metrics" | ||
| "go.temporal.io/server/common/namespace" | ||
| "go.temporal.io/server/common/quotas" | ||
| "go.temporal.io/server/common/quotas/calculator" | ||
| "go.temporal.io/server/common/resource" | ||
| "go.temporal.io/server/common/sdk" | ||
| workercommon "go.temporal.io/server/service/worker/common" | ||
|
|
@@ -24,6 +28,8 @@ const ( | |
| ) | ||
|
|
||
| type ( | ||
| AdminBatcherRateLimiter quotas.RequestRateLimiter | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our internal implementation only implements |
||
|
|
||
| workerComponent struct { | ||
| activityDeps activityDeps | ||
| dc *dynamicconfig.Collection | ||
|
|
@@ -32,12 +38,13 @@ type ( | |
|
|
||
| activityDeps struct { | ||
| fx.In | ||
| MetricsHandler metrics.Handler | ||
| Logger log.Logger | ||
| ClientFactory sdk.ClientFactory | ||
| FrontendClient workflowservice.WorkflowServiceClient | ||
| AdminClient adminservice.AdminServiceClient | ||
| HistoryClient resource.HistoryClient | ||
| MetricsHandler metrics.Handler | ||
| Logger log.Logger | ||
| ClientFactory sdk.ClientFactory | ||
| FrontendClient workflowservice.WorkflowServiceClient | ||
| AdminClient adminservice.AdminServiceClient | ||
| HistoryClient resource.HistoryClient | ||
| AdminBatcherRateLimiter AdminBatcherRateLimiter | ||
| } | ||
|
|
||
| fxResult struct { | ||
|
|
@@ -47,9 +54,29 @@ type ( | |
| ) | ||
|
|
||
| var Module = fx.Options( | ||
| fx.Provide(AdminBatcherRateLimiterProvider), | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This allows us to inject a different implementation in cloud. |
||
| fx.Provide(NewResult), | ||
| ) | ||
|
|
||
| func AdminBatcherRateLimiterProvider( | ||
| dc *dynamicconfig.Collection, | ||
| serviceResolver membership.ServiceResolver, | ||
| logger log.Logger, | ||
| ) AdminBatcherRateLimiter { | ||
| return quotas.NewRequestRateLimiterAdapter( | ||
| quotas.NewDefaultOutgoingRateLimiter( | ||
| calculator.NewLoggedCalculator( | ||
| calculator.ClusterAwareQuotaCalculator{ | ||
| MemberCounter: serviceResolver, | ||
| PerInstanceQuota: dynamicconfig.AdminBatcherHostRPS.Get(dc), | ||
| GlobalQuota: dynamicconfig.AdminBatcherGlobalRPS.Get(dc), | ||
| }, | ||
| log.With(logger, tag.ComponentAdminBatcher, tag.ScopeHost), | ||
| ).GetQuota, | ||
| ), | ||
| ) | ||
| } | ||
|
|
||
| func NewResult( | ||
| dc *dynamicconfig.Collection, | ||
| params activityDeps, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.