-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 1 commit
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" | ||
|
|
@@ -25,9 +29,10 @@ const ( | |
|
|
||
| type ( | ||
| workerComponent struct { | ||
| activityDeps activityDeps | ||
| dc *dynamicconfig.Collection | ||
| enabledFeature dynamicconfig.BoolPropertyFnWithNamespaceFilter | ||
| activityDeps activityDeps | ||
| dc *dynamicconfig.Collection | ||
| adminBatcherHostRateLimiter quotas.RateLimiter | ||
| enabledFeature dynamicconfig.BoolPropertyFnWithNamespaceFilter | ||
| } | ||
|
|
||
| activityDeps struct { | ||
|
|
@@ -52,13 +57,24 @@ var Module = fx.Options( | |
|
|
||
| func NewResult( | ||
| dc *dynamicconfig.Collection, | ||
| serviceResolver membership.ServiceResolver, | ||
| params activityDeps, | ||
| ) fxResult { | ||
| adminBatcherHostRateFn := calculator.NewLoggedCalculator( | ||
| calculator.ClusterAwareQuotaCalculator{ | ||
| MemberCounter: serviceResolver, | ||
|
Contributor
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. shouldn't this pay attention to the per-ns worker count? you can get the number from the
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. hmm not really? this is limit across all namespaces and all admin batch jobs.
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. actually I will check if I can just use the distributed rate limit here.
Contributor
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. oh I see, I misunderstood the scope |
||
| PerInstanceQuota: dynamicconfig.AdminBatcherHostRPS.Get(dc), | ||
| GlobalQuota: dynamicconfig.AdminBatcherGlobalRPS.Get(dc), | ||
| }, | ||
| log.With(params.Logger, tag.ComponentAdminBatcher, tag.ScopeHost), | ||
| ).GetQuota | ||
|
|
||
| return fxResult{ | ||
| Component: &workerComponent{ | ||
| activityDeps: params, | ||
| dc: dc, | ||
| enabledFeature: dynamicconfig.EnableBatcherNamespace.Get(dc), | ||
| activityDeps: params, | ||
| dc: dc, | ||
| enabledFeature: dynamicconfig.EnableBatcherNamespace.Get(dc), | ||
| adminBatcherHostRateLimiter: quotas.NewDefaultOutgoingRateLimiter(adminBatcherHostRateFn), | ||
| }, | ||
| } | ||
| } | ||
|
|
@@ -83,10 +99,11 @@ func (s *workerComponent) Register(registry sdkworker.Registry, ns *namespace.Na | |
|
|
||
| func (s *workerComponent) activities(name namespace.Name, id namespace.ID) *activities { | ||
| return &activities{ | ||
| activityDeps: s.activityDeps, | ||
| namespace: name, | ||
| namespaceID: id, | ||
| rps: dynamicconfig.BatcherRPS.Get(s.dc), | ||
| concurrency: dynamicconfig.BatcherConcurrency.Get(s.dc), | ||
| activityDeps: s.activityDeps, | ||
| namespace: name, | ||
| namespaceID: id, | ||
| rps: dynamicconfig.BatcherRPS.Get(s.dc), | ||
| concurrency: dynamicconfig.BatcherConcurrency.Get(s.dc), | ||
| adminBatcherHostRateLimiter: s.adminBatcherHostRateLimiter, | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.