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

Created Shard Manager Service #6297

Merged
merged 6 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/server/cadence/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import (
"github.com/uber/cadence/service/frontend"
"github.com/uber/cadence/service/history"
"github.com/uber/cadence/service/matching"
"github.com/uber/cadence/service/shardmanager"
"github.com/uber/cadence/service/worker"
)

Expand Down Expand Up @@ -322,6 +323,8 @@ func (s *server) startService() common.Daemon {
daemon, err = matching.NewService(&params)
case service.Worker:
daemon, err = worker.NewService(&params)
case service.ShardManager:
jakobht marked this conversation as resolved.
Show resolved Hide resolved
daemon, err = shardmanager.NewService(&params, resource.NewResourceFactory())
}
if err != nil {
params.Logger.Fatal("Fail to start "+s.name+" service ", tag.Error(err))
Expand Down
38 changes: 38 additions & 0 deletions common/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,29 @@ const (
// Value type: Int
// Default value: 100
ESAnalyzerMinNumWorkflowsForAvg

// key for shard manager

// ShardManagerPersistenceMaxQPS is the max qps a shard manager host can query DB
// KeyName: shardManager.persistenceMaxQPS
// Value type: Int
// Default value: 3000
// Allowed filters: N/A
ShardManagerPersistenceMaxQPS
// ShardManagerPersistenceGlobalMaxQPS is the max qps matching cluster can query DB
// KeyName: shardManager.persistenceGlobalMaxQPS
// Value type: Int
// Default value: 0
// Allowed filters: N/A
ShardManagerPersistenceGlobalMaxQPS

// ShardManagerThrottledLogRPS is the rate limit on number of log messages emitted per second for throttled logger
// KeyName: shardManager.throttledLogRPS
// Value type: Int
// Default value: 20
// Allowed filters: N/A
ShardManagerThrottledLogRPS

// Usage: VisibilityArchivalQueryMaxRangeInDays is the maximum number of days for a visibility archival query
// KeyName: N/A
// Default value: N/A
Expand Down Expand Up @@ -3921,6 +3944,21 @@ var IntKeys = map[IntKey]DynamicInt{
Description: "ESAnalyzerMinNumWorkflowsForAvg controls how many workflows to have at least to rely on workflow run time avg per type",
DefaultValue: 100,
},
ShardManagerPersistenceMaxQPS: {
KeyName: "shardManager.persistenceMaxQPS",
Description: "ShardManagerPersistenceMaxQPS is the max qps shard manager host can query DB",
DefaultValue: 3000,
},
ShardManagerPersistenceGlobalMaxQPS: {
KeyName: "shardManager.persistenceGlobalMaxQPS",
Description: "ShardManagerPersistenceGlobalMaxQPS is the max qps shard manager cluster can query DB",
DefaultValue: 0,
},
ShardManagerThrottledLogRPS: {
KeyName: "shardManager.throttledLogRPS",
Description: "ShardManagerThrottledLogRPS is the rate limit on number of log messages emitted per second for throttled logger",
DefaultValue: 20,
},
VisibilityArchivalQueryMaxRangeInDays: {
KeyName: "frontend.visibilityArchivalQueryMaxRangeInDays",
Description: "VisibilityArchivalQueryMaxRangeInDays is the maximum number of days for a visibility archival query",
Expand Down
1 change: 1 addition & 0 deletions common/metrics/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const (
History
Matching
Worker
ShardManager
NumServices
)

Expand Down
10 changes: 10 additions & 0 deletions common/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination resource_mock.go -self_package github.com/uber/cadence/common/resource

package resource

import (
Expand Down Expand Up @@ -48,8 +50,16 @@ import (
"github.com/uber/cadence/common/persistence"
persistenceClient "github.com/uber/cadence/common/persistence/client"
"github.com/uber/cadence/common/quotas/global/rpc"
"github.com/uber/cadence/common/service"
)

type ResourceFactory interface {
NewResource(params *Params,
serviceName string,
serviceConfig *service.Config,
) (resource Resource, err error)
}

type (
// Resource is the interface which expose common resources
Resource interface {
Expand Down
13 changes: 13 additions & 0 deletions common/resource/resourceImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@
"github.com/uber/cadence/common/service"
)

func NewResourceFactory() ResourceFactory {
return &resourceImplFactory{}

Check warning on line 67 in common/resource/resourceImpl.go

View check run for this annotation

Codecov / codecov/patch

common/resource/resourceImpl.go#L66-L67

Added lines #L66 - L67 were not covered by tests
}

type resourceImplFactory struct{}

func (*resourceImplFactory) NewResource(params *Params,
serviceName string,
serviceConfig *service.Config,
) (resource Resource, err error) {
return New(params, serviceName, serviceConfig)

Check warning on line 76 in common/resource/resourceImpl.go

View check run for this annotation

Codecov / codecov/patch

common/resource/resourceImpl.go#L75-L76

Added lines #L75 - L76 were not covered by tests
}

type (

// VisibilityManagerInitializer is the function each service should implement
Expand Down
Loading
Loading