Skip to content

Commit

Permalink
Run one per-ns worker per namespace instead of namespace × component (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dnr authored and yycptt committed Aug 12, 2022
1 parent 6aaddf3 commit bd22047
Show file tree
Hide file tree
Showing 7 changed files with 272 additions and 277 deletions.
4 changes: 2 additions & 2 deletions common/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,10 +630,10 @@ const (
WorkerParentCloseMaxConcurrentActivityTaskPollers = "worker.ParentCloseMaxConcurrentActivityTaskPollers"
// WorkerParentCloseMaxConcurrentWorkflowTaskPollers indicates worker parent close worker max concurrent workflow pollers
WorkerParentCloseMaxConcurrentWorkflowTaskPollers = "worker.ParentCloseMaxConcurrentWorkflowTaskPollers"
// WorkerPerNamespaceWorkerCount controls number of per-ns (scheduler, batcher, etc.) workers to run per namespace
WorkerPerNamespaceWorkerCount = "worker.perNamespaceWorkerCount"
// WorkerEnableScheduler controls whether to start the worker for scheduled workflows
WorkerEnableScheduler = "worker.enableScheduler"
// WorkerSchedulerNumWorkers controls number of scheduler workers to run per namespace
WorkerSchedulerNumWorkers = "worker.schedulerNumWorkers"
)

// Filter represents a filter on the dynamic config key
Expand Down
3 changes: 2 additions & 1 deletion service/frontend/workflowHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import (
"go.temporal.io/server/common/primitives/timestamp"
"go.temporal.io/server/common/rpc/interceptor"
"go.temporal.io/server/common/searchattribute"
workercommon "go.temporal.io/server/service/worker/common"
"go.temporal.io/server/service/worker/scheduler"
)

Expand Down Expand Up @@ -3128,7 +3129,7 @@ func (wh *WorkflowHandler) CreateSchedule(ctx context.Context, request *workflow
Namespace: request.Namespace,
WorkflowId: request.ScheduleId,
WorkflowType: &commonpb.WorkflowType{Name: scheduler.WorkflowType},
TaskQueue: &taskqueuepb.TaskQueue{Name: scheduler.TaskQueueName},
TaskQueue: &taskqueuepb.TaskQueue{Name: workercommon.PerNSWorkerTaskQueue},
Input: inputPayload,
Identity: request.Identity,
RequestId: request.RequestId,
Expand Down
13 changes: 6 additions & 7 deletions service/worker/common/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ import (
"go.temporal.io/server/common/namespace"
)

const (
// All per-ns workers share one task queue
PerNSWorkerTaskQueue = "temporal-sys-per-ns-tq"
)

type (
// WorkerComponent represents a type of work needed for worker role
WorkerComponent interface {
Expand Down Expand Up @@ -60,13 +65,7 @@ type (
}

PerNSDedicatedWorkerOptions struct {
// Set this to false to disable a worker for this namespace
// Set this to false to disable this worker for this namespace
Enabled bool
// TaskQueue is required
TaskQueue string
// How many worker nodes should run a worker per namespace
NumWorkers int
// Other worker options
Options sdkworker.Options
}
)
Loading

0 comments on commit bd22047

Please sign in to comment.