From dbec7fbc4b2cd7858d8f9f086eddae1c66e25f8f Mon Sep 17 00:00:00 2001 From: Roey Berman Date: Fri, 16 Jun 2023 14:48:17 -0700 Subject: [PATCH] Apply stricter rate limiting for the RegisterNamespace API --- common/dynamicconfig/constants.go | 8 ++++---- service/frontend/configs/quotas.go | 2 +- service/frontend/configs/quotas_test.go | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/dynamicconfig/constants.go b/common/dynamicconfig/constants.go index d491d3cffa6..4407ba4001c 100644 --- a/common/dynamicconfig/constants.go +++ b/common/dynamicconfig/constants.go @@ -218,7 +218,7 @@ const ( // FrontendRPS is workflow rate limit per second FrontendRPS = "frontend.rps" // FrontendNamespaceReplicationInducingAPIsRPS limits the per second request rate for namespace replication inducing - // APIs (e.g. UpdateNamespace, UpdateWorkerBuildIdCompatibility). + // APIs (e.g. RegisterNamespace, UpdateNamespace, UpdateWorkerBuildIdCompatibility). // This config is EXPERIMENTAL and may be changed or removed in a later release. FrontendNamespaceReplicationInducingAPIsRPS = "frontend.rps.namespaceReplicationInducingAPIs" // FrontendMaxNamespaceRPSPerInstance is workflow namespace rate limit per second @@ -231,14 +231,14 @@ const ( // This config is EXPERIMENTAL and may be changed or removed in a later release. FrontendMaxNamespaceVisibilityRPSPerInstance = "frontend.namespaceRPS.visibility" // FrontendMaxNamespaceNamespaceReplicationInducingAPIsRPSPerInstance is a per host/per namespace RPS limit for - // namespace replication inducing APIs (e.g. UpdateNamespace, UpdateWorkerBuildIdCompatibility). + // namespace replication inducing APIs (e.g. RegisterNamespace, UpdateNamespace, UpdateWorkerBuildIdCompatibility). // This config is EXPERIMENTAL and may be changed or removed in a later release. FrontendMaxNamespaceNamespaceReplicationInducingAPIsRPSPerInstance = "frontend.namespaceRPS.namespaceReplicationInducingAPIs" // FrontendMaxNamespaceVisibilityBurstPerInstance is namespace burst limit for visibility APIs. // This config is EXPERIMENTAL and may be changed or removed in a later release. FrontendMaxNamespaceVisibilityBurstPerInstance = "frontend.namespaceBurst.visibility" // FrontendMaxNamespaceNamespaceReplicationInducingAPIsBurstPerInstance is a per host/per namespace burst limit for - // namespace replication inducing APIs (e.g. UpdateNamespace, UpdateWorkerBuildIdCompatibility). + // namespace replication inducing APIs (e.g. RegisterNamespace, UpdateNamespace, UpdateWorkerBuildIdCompatibility). // This config is EXPERIMENTAL and may be changed or removed in a later release. FrontendMaxNamespaceNamespaceReplicationInducingAPIsBurstPerInstance = "frontend.namespaceBurst.namespaceReplicationInducingAPIs" // FrontendGlobalNamespaceRPS is workflow namespace rate limit per second for the whole cluster. @@ -254,7 +254,7 @@ const ( // This config is EXPERIMENTAL and may be changed or removed in a later release. FrontendGlobalNamespaceVisibilityRPS = "frontend.globalNamespaceRPS.visibility" // FrontendGlobalNamespaceNamespaceReplicationInducingAPIsRPS is a cluster global, per namespace RPS limit for - // namespace replication inducing APIs (e.g. UpdateNamespace, UpdateWorkerBuildIdCompatibility). + // namespace replication inducing APIs (e.g. RegisterNamespace, UpdateNamespace, UpdateWorkerBuildIdCompatibility). // The limit is evenly distributed among available frontend service instances. // If this is set, it overwrites the per instance limit configured with // "frontend.namespaceRPS.namespaceReplicationInducingAPIs". diff --git a/service/frontend/configs/quotas.go b/service/frontend/configs/quotas.go index 2294b6d8875..9c48b7634d9 100644 --- a/service/frontend/configs/quotas.go +++ b/service/frontend/configs/quotas.go @@ -98,6 +98,7 @@ var ( // The replication queue is used to propagate critical failover messages and this mapping prevents flooding the // queue and delaying failover. NamespaceReplicationInducingAPIToPriority = map[string]int{ + "RegisterNamespace": 0, "UpdateNamespace": 0, "UpdateWorkerBuildIdCompatibility": 1, } @@ -109,7 +110,6 @@ var ( "GetSystemInfo": 0, "GetSearchAttributes": 0, - "RegisterNamespace": 0, "DescribeNamespace": 0, "ListNamespaces": 0, "DeprecateNamespace": 0, diff --git a/service/frontend/configs/quotas_test.go b/service/frontend/configs/quotas_test.go index d48027cf2a5..c7bf63c3b0e 100644 --- a/service/frontend/configs/quotas_test.go +++ b/service/frontend/configs/quotas_test.go @@ -186,8 +186,9 @@ func (s *quotasSuite) TestVisibilityAPIs() { func (s *quotasSuite) TestNamespaceReplicationInducingAPIs() { apis := map[string]struct{}{ - "UpdateWorkerBuildIdCompatibility": {}, + "RegisterNamespace": {}, "UpdateNamespace": {}, + "UpdateWorkerBuildIdCompatibility": {}, } var service workflowservice.WorkflowServiceServer @@ -208,7 +209,6 @@ func (s *quotasSuite) TestOtherAPIs() { "GetSystemInfo": {}, "GetSearchAttributes": {}, - "RegisterNamespace": {}, "DescribeNamespace": {}, "ListNamespaces": {}, "DeprecateNamespace": {},