Skip to content

Commit 9156239

Browse files
authored
Poller Scaling Decisions (#553)
Added a proto that is optionally attached to task responses and contains data for the SDK about whether or not pollers should be scaled up or down.
1 parent add5b50 commit 9156239

File tree

4 files changed

+63
-2
lines changed

4 files changed

+63
-2
lines changed

Diff for: openapi/openapiv2.json

+23
Original file line numberDiff line numberDiff line change
@@ -11281,6 +11281,10 @@
1128111281
"retryPolicy": {
1128211282
"$ref": "#/definitions/v1RetryPolicy",
1128311283
"description": "This is the retry policy the service uses which may be different from the one provided\n(or not) during activity scheduling. The service can override the provided one if some\nvalues are not specified or exceed configured system limits."
11284+
},
11285+
"pollerScalingDecision": {
11286+
"$ref": "#/definitions/v1PollerScalingDecision",
11287+
"description": "Server-advised information the SDK may use to adjust its poller count."
1128411288
}
1128511289
}
1128611290
},
@@ -11295,6 +11299,10 @@
1129511299
"request": {
1129611300
"$ref": "#/definitions/apinexusv1Request",
1129711301
"description": "Embedded request as translated from the incoming frontend request."
11302+
},
11303+
"pollerScalingDecision": {
11304+
"$ref": "#/definitions/v1PollerScalingDecision",
11305+
"description": "Server-advised information the SDK may use to adjust its poller count."
1129811306
}
1129911307
}
1130011308
},
@@ -11390,6 +11398,10 @@
1139011398
"$ref": "#/definitions/v1Message"
1139111399
},
1139211400
"title": "Protocol messages piggybacking on a WFT as a transport"
11401+
},
11402+
"pollerScalingDecision": {
11403+
"$ref": "#/definitions/v1PollerScalingDecision",
11404+
"description": "Server-advised information the SDK may use to adjust its poller count."
1139311405
}
1139411406
}
1139511407
},
@@ -11417,6 +11429,17 @@
1141711429
}
1141811430
}
1141911431
},
11432+
"v1PollerScalingDecision": {
11433+
"type": "object",
11434+
"properties": {
11435+
"pollRequestDeltaSuggestion": {
11436+
"type": "integer",
11437+
"format": "int32",
11438+
"description": "How many poll requests to suggest should be added or removed, if any. As of now, server only\nscales up or down by 1. However, SDKs should allow for other values (while staying within\ndefined min/max).\n\nThe SDK is free to ignore this suggestion, EX: making more polls would not make sense because\nall slots are already occupied."
11439+
}
11440+
},
11441+
"description": "Attached to task responses to give hints to the SDK about how it may adjust its number of\npollers."
11442+
},
1142011443
"v1ProtocolMessageCommandAttributes": {
1142111444
"type": "object",
1142211445
"properties": {

Diff for: openapi/openapiv3.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -8566,6 +8566,10 @@ components:
85668566
items:
85678567
$ref: '#/components/schemas/Message'
85688568
description: Protocol messages piggybacking on a WFT as a transport
8569+
pollerScalingDecision:
8570+
allOf:
8571+
- $ref: '#/components/schemas/PollerScalingDecision'
8572+
description: Server-advised information the SDK may use to adjust its poller count.
85698573
PollerInfo:
85708574
type: object
85718575
properties:
@@ -8588,6 +8592,22 @@ components:
85888592
allOf:
85898593
- $ref: '#/components/schemas/WorkerDeploymentOptions'
85908594
description: Worker deployment options that SDK sent to server.
8595+
PollerScalingDecision:
8596+
type: object
8597+
properties:
8598+
pollRequestDeltaSuggestion:
8599+
type: integer
8600+
description: |-
8601+
How many poll requests to suggest should be added or removed, if any. As of now, server only
8602+
scales up or down by 1. However, SDKs should allow for other values (while staying within
8603+
defined min/max).
8604+
8605+
The SDK is free to ignore this suggestion, EX: making more polls would not make sense because
8606+
all slots are already occupied.
8607+
format: int32
8608+
description: |-
8609+
Attached to task responses to give hints to the SDK about how it may adjust its number of
8610+
pollers.
85918611
QueryRejected:
85928612
type: object
85938613
properties:

Diff for: temporal/api/taskqueue/v1/message.proto

+13-1
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,16 @@ message TimestampedBuildIdAssignmentRule {
323323
message TimestampedCompatibleBuildIdRedirectRule {
324324
CompatibleBuildIdRedirectRule rule = 1;
325325
google.protobuf.Timestamp create_time = 2;
326-
}
326+
}
327+
328+
// Attached to task responses to give hints to the SDK about how it may adjust its number of
329+
// pollers.
330+
message PollerScalingDecision {
331+
// How many poll requests to suggest should be added or removed, if any. As of now, server only
332+
// scales up or down by 1. However, SDKs should allow for other values (while staying within
333+
// defined min/max).
334+
//
335+
// The SDK is free to ignore this suggestion, EX: making more polls would not make sense because
336+
// all slots are already occupied.
337+
int32 poll_request_delta_suggestion = 1;
338+
}

Diff for: temporal/api/workflowservice/v1/request_response.proto

+7-1
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ message PollWorkflowTaskQueueResponse {
331331
map<string, temporal.api.query.v1.WorkflowQuery> queries = 14;
332332
// Protocol messages piggybacking on a WFT as a transport
333333
repeated temporal.api.protocol.v1.Message messages = 15;
334+
// Server-advised information the SDK may use to adjust its poller count.
335+
temporal.api.taskqueue.v1.PollerScalingDecision poller_scaling_decision = 16;
334336
}
335337

336338
message RespondWorkflowTaskCompletedRequest {
@@ -496,6 +498,8 @@ message PollActivityTaskQueueResponse {
496498
// (or not) during activity scheduling. The service can override the provided one if some
497499
// values are not specified or exceed configured system limits.
498500
temporal.api.common.v1.RetryPolicy retry_policy = 17;
501+
// Server-advised information the SDK may use to adjust its poller count.
502+
temporal.api.taskqueue.v1.PollerScalingDecision poller_scaling_decision = 18;
499503
}
500504

501505
message RecordActivityTaskHeartbeatRequest {
@@ -1733,6 +1737,8 @@ message PollNexusTaskQueueResponse {
17331737
bytes task_token = 1;
17341738
// Embedded request as translated from the incoming frontend request.
17351739
temporal.api.nexus.v1.Request request = 2;
1740+
// Server-advised information the SDK may use to adjust its poller count.
1741+
temporal.api.taskqueue.v1.PollerScalingDecision poller_scaling_decision = 3;
17361742
}
17371743

17381744
message RespondNexusTaskCompletedRequest {
@@ -2106,7 +2112,7 @@ message ListWorkerDeploymentsResponse {
21062112
bytes next_page_token = 1;
21072113
// The list of worker deployments.
21082114
repeated WorkerDeploymentSummary worker_deployments = 2;
2109-
2115+
21102116
// (-- api-linter: core::0123::resource-annotation=disabled --)
21112117
// A subset of WorkerDeploymentInfo
21122118
message WorkerDeploymentSummary {

0 commit comments

Comments
 (0)