Skip to content

Commit

Permalink
feat: more flexible scaling with replicasPerScaleUp and `replicasPe…
Browse files Browse the repository at this point in the history
…rScaleDown` (#2003)

Signed-off-by: Derek Wang <[email protected]>
  • Loading branch information
whynowy authored Aug 26, 2024
1 parent 102d1de commit 91f372c
Show file tree
Hide file tree
Showing 18 changed files with 768 additions and 630 deletions.
17 changes: 11 additions & 6 deletions api/json-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19734,11 +19734,6 @@
"io.numaproj.numaflow.v1alpha1.Scale": {
"description": "Scale defines the parameters for autoscaling.",
"properties": {
"cooldownSeconds": {
"description": "Deprecated: Use scaleUpCooldownSeconds and scaleDownCooldownSeconds instead. Cooldown seconds after a scaling operation before another one.",
"format": "int64",
"type": "integer"
},
"disabled": {
"description": "Whether to disable autoscaling. Set to \"true\" when using Kubernetes HPA or any other 3rd party autoscaling strategies.",
"type": "boolean"
Expand All @@ -19759,7 +19754,17 @@
"type": "integer"
},
"replicasPerScale": {
"description": "ReplicasPerScale defines maximum replicas can be scaled up or down at once. The is use to prevent too aggressive scaling operations",
"description": "DeprecatedReplicasPerScale defines the number of maximum replicas that can be changed in a single scale up or down operation. The is use to prevent from too aggressive scaling operations Deprecated: Use ReplicasPerScaleUp and ReplicasPerScaleDown instead",
"format": "int64",
"type": "integer"
},
"replicasPerScaleDown": {
"description": "ReplicasPerScaleDown defines the number of maximum replicas that can be changed in a single scaled down operation. The is use to prevent from too aggressive scaling down operations",
"format": "int64",
"type": "integer"
},
"replicasPerScaleUp": {
"description": "ReplicasPerScaleUp defines the number of maximum replicas that can be changed in a single scaled up operation. The is use to prevent from too aggressive scaling up operations",
"format": "int64",
"type": "integer"
},
Expand Down
17 changes: 11 additions & 6 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -19721,11 +19721,6 @@
"description": "Scale defines the parameters for autoscaling.",
"type": "object",
"properties": {
"cooldownSeconds": {
"description": "Deprecated: Use scaleUpCooldownSeconds and scaleDownCooldownSeconds instead. Cooldown seconds after a scaling operation before another one.",
"type": "integer",
"format": "int64"
},
"disabled": {
"description": "Whether to disable autoscaling. Set to \"true\" when using Kubernetes HPA or any other 3rd party autoscaling strategies.",
"type": "boolean"
Expand All @@ -19746,7 +19741,17 @@
"format": "int32"
},
"replicasPerScale": {
"description": "ReplicasPerScale defines maximum replicas can be scaled up or down at once. The is use to prevent too aggressive scaling operations",
"description": "DeprecatedReplicasPerScale defines the number of maximum replicas that can be changed in a single scale up or down operation. The is use to prevent from too aggressive scaling operations Deprecated: Use ReplicasPerScaleUp and ReplicasPerScaleDown instead",
"type": "integer",
"format": "int64"
},
"replicasPerScaleDown": {
"description": "ReplicasPerScaleDown defines the number of maximum replicas that can be changed in a single scaled down operation. The is use to prevent from too aggressive scaling down operations",
"type": "integer",
"format": "int64"
},
"replicasPerScaleUp": {
"description": "ReplicasPerScaleUp defines the number of maximum replicas that can be changed in a single scaled up operation. The is use to prevent from too aggressive scaling up operations",
"type": "integer",
"format": "int64"
},
Expand Down
9 changes: 6 additions & 3 deletions config/base/crds/full/numaflow.numaproj.io_monovertices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2210,9 +2210,6 @@ spec:
type: string
scale:
properties:
cooldownSeconds:
format: int32
type: integer
disabled:
type: boolean
lookbackSeconds:
Expand All @@ -2227,6 +2224,12 @@ spec:
replicasPerScale:
format: int32
type: integer
replicasPerScaleDown:
format: int32
type: integer
replicasPerScaleUp:
format: int32
type: integer
scaleDownCooldownSeconds:
format: int32
type: integer
Expand Down
9 changes: 6 additions & 3 deletions config/base/crds/full/numaflow.numaproj.io_pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5939,9 +5939,6 @@ spec:
type: string
scale:
properties:
cooldownSeconds:
format: int32
type: integer
disabled:
type: boolean
lookbackSeconds:
Expand All @@ -5956,6 +5953,12 @@ spec:
replicasPerScale:
format: int32
type: integer
replicasPerScaleDown:
format: int32
type: integer
replicasPerScaleUp:
format: int32
type: integer
scaleDownCooldownSeconds:
format: int32
type: integer
Expand Down
9 changes: 6 additions & 3 deletions config/base/crds/full/numaflow.numaproj.io_vertices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1587,9 +1587,6 @@ spec:
type: string
scale:
properties:
cooldownSeconds:
format: int32
type: integer
disabled:
type: boolean
lookbackSeconds:
Expand All @@ -1604,6 +1601,12 @@ spec:
replicasPerScale:
format: int32
type: integer
replicasPerScaleDown:
format: int32
type: integer
replicasPerScaleUp:
format: int32
type: integer
scaleDownCooldownSeconds:
format: int32
type: integer
Expand Down
27 changes: 18 additions & 9 deletions config/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4822,9 +4822,6 @@ spec:
type: string
scale:
properties:
cooldownSeconds:
format: int32
type: integer
disabled:
type: boolean
lookbackSeconds:
Expand All @@ -4839,6 +4836,12 @@ spec:
replicasPerScale:
format: int32
type: integer
replicasPerScaleDown:
format: int32
type: integer
replicasPerScaleUp:
format: int32
type: integer
scaleDownCooldownSeconds:
format: int32
type: integer
Expand Down Expand Up @@ -14096,9 +14099,6 @@ spec:
type: string
scale:
properties:
cooldownSeconds:
format: int32
type: integer
disabled:
type: boolean
lookbackSeconds:
Expand All @@ -14113,6 +14113,12 @@ spec:
replicasPerScale:
format: int32
type: integer
replicasPerScaleDown:
format: int32
type: integer
replicasPerScaleUp:
format: int32
type: integer
scaleDownCooldownSeconds:
format: int32
type: integer
Expand Down Expand Up @@ -19518,9 +19524,6 @@ spec:
type: string
scale:
properties:
cooldownSeconds:
format: int32
type: integer
disabled:
type: boolean
lookbackSeconds:
Expand All @@ -19535,6 +19538,12 @@ spec:
replicasPerScale:
format: int32
type: integer
replicasPerScaleDown:
format: int32
type: integer
replicasPerScaleUp:
format: int32
type: integer
scaleDownCooldownSeconds:
format: int32
type: integer
Expand Down
27 changes: 18 additions & 9 deletions config/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4822,9 +4822,6 @@ spec:
type: string
scale:
properties:
cooldownSeconds:
format: int32
type: integer
disabled:
type: boolean
lookbackSeconds:
Expand All @@ -4839,6 +4836,12 @@ spec:
replicasPerScale:
format: int32
type: integer
replicasPerScaleDown:
format: int32
type: integer
replicasPerScaleUp:
format: int32
type: integer
scaleDownCooldownSeconds:
format: int32
type: integer
Expand Down Expand Up @@ -14096,9 +14099,6 @@ spec:
type: string
scale:
properties:
cooldownSeconds:
format: int32
type: integer
disabled:
type: boolean
lookbackSeconds:
Expand All @@ -14113,6 +14113,12 @@ spec:
replicasPerScale:
format: int32
type: integer
replicasPerScaleDown:
format: int32
type: integer
replicasPerScaleUp:
format: int32
type: integer
scaleDownCooldownSeconds:
format: int32
type: integer
Expand Down Expand Up @@ -19518,9 +19524,6 @@ spec:
type: string
scale:
properties:
cooldownSeconds:
format: int32
type: integer
disabled:
type: boolean
lookbackSeconds:
Expand All @@ -19535,6 +19538,12 @@ spec:
replicasPerScale:
format: int32
type: integer
replicasPerScaleDown:
format: int32
type: integer
replicasPerScaleUp:
format: int32
type: integer
scaleDownCooldownSeconds:
format: int32
type: integer
Expand Down
68 changes: 46 additions & 22 deletions docs/APIs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8428,26 +8428,6 @@ processing rate.

<td>

<code>cooldownSeconds</code></br> <em> uint32 </em>
</td>

<td>

<em>(Optional)</em>
<p>

Deprecated: Use scaleUpCooldownSeconds and scaleDownCooldownSeconds
instead. Cooldown seconds after a scaling operation before another one.
</p>

</td>

</tr>

<tr>

<td>

<code>zeroReplicaSleepSeconds</code></br> <em> uint32 </em>
</td>

Expand Down Expand Up @@ -8522,8 +8502,10 @@ have buffers to read.
<em>(Optional)</em>
<p>

ReplicasPerScale defines maximum replicas can be scaled up or down at
once. The is use to prevent too aggressive scaling operations
DeprecatedReplicasPerScale defines the number of maximum replicas that
can be changed in a single scale up or down operation. The is use to
prevent from too aggressive scaling operations Deprecated: Use
ReplicasPerScaleUp and ReplicasPerScaleDown instead
</p>

</td>
Expand Down Expand Up @@ -8572,6 +8554,48 @@ CooldownSeconds if not set.

</tr>

<tr>

<td>

<code>replicasPerScaleUp</code></br> <em> uint32 </em>
</td>

<td>

<em>(Optional)</em>
<p>

ReplicasPerScaleUp defines the number of maximum replicas that can be
changed in a single scaled up operation. The is use to prevent from too
aggressive scaling up operations
</p>

</td>

</tr>

<tr>

<td>

<code>replicasPerScaleDown</code></br> <em> uint32 </em>
</td>

<td>

<em>(Optional)</em>
<p>

ReplicasPerScaleDown defines the number of maximum replicas that can be
changed in a single scaled down operation. The is use to prevent from
too aggressive scaling down operations
</p>

</td>

</tr>

</tbody>

</table>
Expand Down
8 changes: 6 additions & 2 deletions docs/user-guide/reference/autoscaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ spec:
zeroReplicaSleepSeconds: 120 # Optional, defaults to 120.
targetProcessingSeconds: 20 # Optional, defaults to 20.
targetBufferAvailability: 50 # Optional, defaults to 50.
replicasPerScale: 2 # Optional, defaults to 2.
replicasPerScaleUp: 2 # Optional, defaults to 2.
replicasPerScaleDown: 2 # Optional, defaults to 2.
```

- `disabled` - Whether to disable Numaflow autoscaling, defaults to `false`.
Expand All @@ -60,8 +61,11 @@ spec:
support autoscaling, typically increasing the value leads to lower processing rate, thus less replicas.
- `targetBufferAvailability` - Targeted buffer availability in percentage, defaults to `50`. It is only effective for `UDF`
and `Sink` vertices, it determines how aggressive you want to do for autoscaling, increasing the value will bring more replicas.
- `replicasPerScale` - Maximum number of replicas change happens in one scale up or down operation, defaults to `2`. For
- `replicasPerScaleUp` - Maximum number of replica change happens in one scale up operation, defaults to `2`. For
example, if current replica number is 3, the calculated desired replica number is 8; instead of scaling up the vertex to 8, it only does 5.
- `replicasPerScaleDown` - Maximum number of replica change happens in one scale down operation, defaults to `2`. For
example, if current replica number is 9, the calculated desired replica number is 4; instead of scaling down the vertex to 4, it only does 7.
- `replicasPerScale` - (Deprecated: Use `replicasPerScaleUp` and `replicasPerScaleDown` instead, will be removed in v1.5) Maximum number of replica change happens in one scale up or down operation, defaults to `2`.

To disable Numaflow autoscaling, set `disabled: true` as following.

Expand Down
Loading

0 comments on commit 91f372c

Please sign in to comment.