Skip to content

Commit 6962837

Browse files
authored
docs: doc adjustment due to MonoVertex (#2496)
Signed-off-by: Derek Wang <whynowy@gmail.com>
1 parent 70993d5 commit 6962837

File tree

9 files changed

+189
-86
lines changed

9 files changed

+189
-86
lines changed

docs/user-guide/reference/autoscaling.md

Lines changed: 83 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Autoscaling
22

3-
Numaflow is able to run with both `Horizontal Pod Autoscaling` and `Vertical Pod Autoscaling`.
3+
Numaflow [Pipeline](../../core-concepts/pipeline.md) and [MonoVertex](../../core-concepts/monovertex.md) are both able to run with `Horizontal Pod Autoscaling` and `Vertical Pod Autoscaling`.
44

55
## Horizontal Pod Autoscaling
66

@@ -12,12 +12,13 @@ Numaflow is able to run with both `Horizontal Pod Autoscaling` and `Vertical Pod
1212

1313
### Numaflow Autoscaling
1414

15-
Numaflow provides `0 - N` autoscaling capability out of the box, it's available for all the `UDF`, `Sink` and most of
16-
the [`Source`](../sources/overview.md) vertices (please check each source for more details).
15+
Numaflow provides `0 - N` autoscaling capability out of the box, it's available for all the [MonoVertices](../../core-concepts/monovertex.md) and [Pipeline](../../core-concepts/pipeline.md) [vertices](../../core-concepts/vertex.md) including `UDF`, `Sink` and most of
16+
the [`Source`](../sources/overview.md) types (please check each source for more details).
1717

18-
Numaflow autoscaling is enabled by default, there are some parameters can be tuned to achieve better results.
18+
Numaflow autoscaling is enabled by default, there are some parameters can be fine-tuned to achieve better results.
1919

2020
```yaml
21+
# A Pipeline example.
2122
apiVersion: numaflow.numaproj.io/v1alpha1
2223
kind: Pipeline
2324
metadata:
@@ -37,32 +38,50 @@ spec:
3738
targetBufferAvailability: 50 # Optional, defaults to 50.
3839
replicasPerScaleUp: 2 # Optional, defaults to 2.
3940
replicasPerScaleDown: 2 # Optional, defaults to 2.
41+
---
42+
# A MonoVertex example.
43+
apiVersion: numaflow.numaproj.io/v1alpha1
44+
kind: MonoVertex
45+
metadata:
46+
name: my-mvtx
47+
spec:
48+
scale:
49+
disabled: false # Optional, defaults to false.
50+
min: 0 # Optional, minimum replicas, defaults to 0.
51+
max: 20 # Optional, maximum replicas, defaults to 50.
52+
lookbackSeconds: 120 # Optional, defaults to 120.
53+
scaleUpCooldownSeconds: 90 # Optional, defaults to 90.
54+
scaleDownCooldownSeconds: 90 # Optional, defaults to 90.
55+
zeroReplicaSleepSeconds: 120 # Optional, defaults to 120.
56+
targetProcessingSeconds: 20 # Optional, defaults to 20.
57+
replicasPerScaleUp: 2 # Optional, defaults to 2.
58+
replicasPerScaleDown: 2 # Optional, defaults to 2.
4059
```
4160
4261
- `disabled` - Whether to disable Numaflow autoscaling, defaults to `false`.
4362
- `min` - Minimum replicas, valid value could be an integer >= 0. Defaults to `0`, which means it could be scaled down to 0.
4463
- `max` - Maximum replicas, positive integer which should not be less than `min`, defaults to `50`. if `max` and `min`
4564
are the same, that will be the fixed replica number.
46-
- `lookbackSeconds` - How many seconds to lookback for vertex average processing rate (tps) and pending messages calculation,
65+
- `lookbackSeconds` - How many seconds to lookback for average processing rate (tps) and pending messages calculation,
4766
defaults to `120`. Rate and pending messages metrics are critical for autoscaling, you might need to tune this parameter
4867
a bit to see better results. For example, your data source only have 1 minute data input in every 5 minutes, and you
4968
don't want the vertices to be scaled down to `0`. In this case, you need to increase `lookbackSeconds` to overlap
5069
5 minutes, so that the calculated average rate and pending messages won't be `0` during the silent period, in order to prevent from
5170
scaling down to 0.
5271
The max value allowed to be configured is `600`.
5372
On top of this, we have dynamic lookback adjustment which tunes this parameter based on the realtime processing data.
54-
- `scaleUpCooldownSeconds` - After a scaling operation, how many seconds to wait for the same vertex, if the follow-up
73+
- `scaleUpCooldownSeconds` - After a scaling operation, how many seconds to wait for the same Vertex or MonoVertex, if the follow-up
5574
operation is a scaling up, defaults to `90`. Please make sure that the time is greater than the pod to be `Running` and
5675
start processing, because the autoscaling algorithm will divide the TPS by the number of pods even if the pod is not `Running`.
57-
- `scaleDownCooldownSeconds` - After a scaling operation, how many seconds to wait for the same vertex, if the follow-up
76+
- `scaleDownCooldownSeconds` - After a scaling operation, how many seconds to wait for the same Vertex or MonoVertex, if the follow-up
5877
operation is a scaling down, defaults to `90`.
59-
- `zeroReplicaSleepSeconds` - After scaling a source vertex replicas down to `0`, how many seconds to wait before scaling up to 1 replica to peek, defaults to `120`.
60-
Numaflow autoscaler periodically scales up a source vertex pod to "peek" the incoming data, this is the period of time to wait before peeking.
61-
- `targetProcessingSeconds` - It is used to tune the aggressiveness of autoscaling for source vertices, it measures how
62-
fast you want the vertex to process all the pending messages, defaults to `20`. It is only effective for the `Source` vertices that
78+
- `zeroReplicaSleepSeconds` - After scaling a Source Vertex (or MonoVertex) replicas down to `0`, how many seconds to wait before scaling up to 1 replica to peek, defaults to `120`.
79+
Numaflow autoscaler periodically scales up a source vertex (or MonoVertex) pod to "peek" the incoming data, this is the period of time to wait before peeking.
80+
- `targetProcessingSeconds` - It is used to tune the aggressiveness of autoscaling for source vertices (or MonoVertex), it measures how
81+
fast you want the vertex to process all the pending messages, defaults to `20`. It is only effective for the MonoVertices or `Source` vertices in a Pipeline that
6382
support autoscaling, typically increasing the value leads to lower processing rate, thus less replicas.
64-
- `targetBufferAvailability` - Targeted buffer availability in percentage, defaults to `50`. It is only effective for `UDF`
65-
and `Sink` vertices, it determines how aggressive you want to do for autoscaling, increasing the value will bring more replicas.
83+
- `targetBufferAvailability` - [[Pipeline](../../core-concepts/pipeline.md) Only] Targeted buffer availability in percentage, defaults to `50`. It is only effective for `UDF`
84+
and `Sink` vertices of a Pipeline, it determines how aggressive you want to do for autoscaling, increasing the value will bring more replicas.
6685
- `replicasPerScaleUp` - Maximum number of replica change happens in one scale up operation, defaults to `2`. For
6786
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.
6887
- `replicasPerScaleDown` - Maximum number of replica change happens in one scale down operation, defaults to `2`. For
@@ -72,6 +91,7 @@ spec:
7291
To disable Numaflow autoscaling, set `disabled: true` as following.
7392

7493
```yaml
94+
# A Pipeline example.
7595
apiVersion: numaflow.numaproj.io/v1alpha1
7696
kind: Pipeline
7797
metadata:
@@ -81,11 +101,20 @@ spec:
81101
- name: my-vertex
82102
scale:
83103
disabled: true
104+
---
105+
# A MonoVertex example.
106+
apiVersion: numaflow.numaproj.io/v1alpha1
107+
kind: MonoVertex
108+
metadata:
109+
name: my-mvtx
110+
spec:
111+
scale:
112+
disabled: true
84113
```
85114

86115
**Notes**
87116

88-
Numaflow autoscaling does not apply to reduce vertices, and the source vertices which do not have a way to calculate their pending messages.
117+
Numaflow autoscaling does not apply to reduce vertices of a Pipeline, and the source vertices which do not have a way to calculate their pending messages.
89118

90119
- Generator
91120
- HTTP
@@ -98,6 +127,7 @@ For User-defined Sources, if the function `Pending()` returns a negative value,
98127
[Kubernetes HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) is supported in Numaflow for any type of Vertex. To use HPA, remember to point the `scaleTargetRef` to the vertex as below, and disable Numaflow autoscaling in your Pipeline spec.
99128

100129
```yaml
130+
# A Pipeline example.
101131
apiVersion: autoscaling/v2
102132
kind: HorizontalPodAutoscaler
103133
metadata:
@@ -114,6 +144,24 @@ spec:
114144
apiVersion: numaflow.numaproj.io/v1alpha1
115145
kind: Vertex
116146
name: my-vertex
147+
---
148+
# A MonoVertex example.
149+
apiVersion: autoscaling/v2
150+
kind: HorizontalPodAutoscaler
151+
metadata:
152+
name: my-mvtx-hpa
153+
spec:
154+
minReplicas: 1
155+
maxReplicas: 3
156+
metrics:
157+
- resource:
158+
name: cpu
159+
targetAverageUtilization: 50
160+
type: Resource
161+
scaleTargetRef:
162+
apiVersion: numaflow.numaproj.io/v1alpha1
163+
kind: MonoVertex
164+
name: my-mvtx
117165
```
118166

119167
With the configuration above, Kubernetes HPA controller will keep the target utilization of the pods of the Vertex at 50%.
@@ -127,6 +175,7 @@ Third party autoscaling tools like [KEDA](https://keda.sh/) are also supported i
127175
To use KEDA for vertex autoscaling, same as Kubernetes HPA, point the `scaleTargetRef` to your vertex, and disable Numaflow autoscaling in your Pipeline spec.
128176

129177
```yaml
178+
# A Pipeline example.
130179
apiVersion: keda.sh/v1alpha1
131180
kind: ScaledObject
132181
metadata:
@@ -137,16 +186,36 @@ spec:
137186
kind: Vertex
138187
name: my-vertex
139188
... ...
189+
---
190+
# A MonoVertex example.
191+
apiVersion: keda.sh/v1alpha1
192+
kind: ScaledObject
193+
metadata:
194+
name: my-keda-scaler
195+
spec:
196+
scaleTargetRef:
197+
apiVersion: numaflow.numaproj.io/v1alpha1
198+
kind: MonoVertex
199+
name: my-mvtx
200+
... ...
140201
```
141202

142203
## Vertical Pod Autoscaling
143204

144205
`Vertical Pod Autoscaling` can be achieved by setting the `targetRef` to `Vertex` objects as following.
145206

146207
```yaml
208+
# A Pipeline example.
147209
spec:
148210
targetRef:
149211
apiVersion: numaflow.numaproj.io/v1alpha1
150212
kind: Vertex
151213
name: my-vertex
214+
---
215+
# A MonoVertex example.
216+
spec:
217+
targetRef:
218+
apiVersion: numaflow.numaproj.io/v1alpha1
219+
kind: MonoVertex
220+
name: my-mvtx
152221
```

docs/user-guide/reference/conditional-forwarding.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Conditional Forwarding
22

3-
After processing the data, conditional forwarding is doable based on the `Tags` returned in the result.
3+
In a [pipeline](../../core-concepts/pipeline.md), after processing the data, conditional forwarding is doable based on the `tags` returned in the result.
44
Below is a list of different logic operations that can be done on tags.
5+
56
- **and** - forwards the message if all the tags specified are present in Message's tags.
67
- **or** - forwards the message if one of the tags specified is present in Message's tags.
78
- **not** - forwards the message if all the tags specified are not present in Message's tags.
@@ -34,4 +35,3 @@ edges:
3435
- odd-tag
3536
- even-tag
3637
```
37-

docs/user-guide/reference/edge-tuning.md

Lines changed: 0 additions & 36 deletions
This file was deleted.

docs/user-guide/reference/join-vertex.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Joins and Cycles
22

3-
Numaflow Pipeline Edges can be defined such that multiple Vertices can forward messages to a single vertex.
3+
Numaflow [Pipeline](../../core-concepts/pipeline.md) Edges can be defined such that multiple Vertices can forward messages to a single vertex.
44

5-
### Quick Start
5+
### Quick Start
66

77
Please see the following examples:
88

@@ -15,8 +15,9 @@ Please see the following examples:
1515
## Why do we need JOIN
1616

1717
### Without JOIN
18-
Without JOIN, Numaflow could only allow users to build [pipelines](https://numaflow.numaproj.io/core-concepts/pipeline/) where [vertices](https://numaflow.numaproj.io/core-concepts/vertex/)
19-
could only read from previous *one* vertex. This meant that Numaflow could only support simple pipelines or tree-like pipelines.
18+
19+
Without JOIN, Numaflow could only allow users to build [pipelines](../../core-concepts/pipeline.md) where [vertices](../../core-concepts/vertex.md)
20+
could only read from previous _one_ vertex. This meant that Numaflow could only support simple pipelines or tree-like pipelines.
2021
Supporting pipelines where you had to read from multiple sources or UDFs were cumbersome and required creating redundant
2122
vertices.
2223

@@ -27,7 +28,7 @@ vertices.
2728
### With JOIN
2829

2930
Join vertices allow users the flexibility to read from multiple sources, process data from multiple UDFs, and even write
30-
to a single sink. The Pipeline Spec doesn't change at all with JOIN, now you can create multiple Edges that have the
31+
to a single sink. The Pipeline Spec doesn't change at all with JOIN, now you can create multiple Edges that have the
3132
same “To” Vertex, which would have otherwise been prohibited.
3233

3334
![Join Vertex](https://miro.medium.com/v2/resize:fit:1400/1*5Ct-5otqpXTAVCNW_SJnNw.png)
@@ -38,7 +39,7 @@ There is no limitation on which vertices can be joined. For instance, one can jo
3839

3940
## Benefits
4041

41-
The introduction of Join Vertex allows users to eliminate redundancy in their pipelines. It supports many-to-one data
42+
The introduction of Join Vertex allows users to eliminate redundancy in their pipelines. It supports many-to-one data
4243
flow without needing multiple vertices performing the same job.
4344

4445
## Examples
@@ -50,6 +51,7 @@ By joining the sink vertices, we now only need a single vertex responsible for s
5051
![Join on Sink Vertex](https://miro.medium.com/v2/resize:fit:1400/1*5Ct-5otqpXTAVCNW_SJnNw.png)
5152

5253
#### Example
54+
5355
[Join on Sink Vertex](https://github.com/numaproj/numaflow/blob/main/examples/11-join-on-sink.yaml)
5456

5557
### Join on Map Vertex
@@ -79,8 +81,8 @@ use of this is a Map UDF which does some sort of reprocessing of data under cert
7981

8082
![Cycle](https://miro.medium.com/v2/resize:fit:1400/1*wYokY1wa9LhI1hKYimWiKA.png)
8183

82-
Cycles are permitted, except in the case that there's a Reduce Vertex at or downstream of the cycle. (This is because a
83-
cycle inevitably produces late data, which would get dropped by the Reduce Vertex. For this reason, cycles should be
84+
Cycles are permitted, except in the case that there's a Reduce Vertex at or downstream of the cycle. (This is because a
85+
cycle inevitably produces late data, which would get dropped by the Reduce Vertex. For this reason, cycles should be
8486
used sparingly.)
8587

8688
The following examples are of Cycles:
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Multi-partitioned Edges
22

3-
To achieve higher throughput(> 10K but < 30K tps), users can create multi-partitioned edges.
4-
Multi-partitioned edges are only supported for pipelines with JetStream as ISB. Please ensure
5-
that the JetStream is provisioned with more nodes to support higher throughput.
3+
To achieve higher throughput(> 10K but < 30K tps), users can create [pipelines](../../core-concepts/pipeline.md) with multi-partitioned edges. Multi-partitioned edges are only supported for [pipelines](../../core-concepts/pipeline.md) with JetStream as [Inter-Step Buffer](../../core-concepts/inter-step-buffer.md). Please ensure that the JetStream is provisioned with more nodes to support higher throughput.
64

7-
Since partitions are owned by the vertex reading the data, to create a multi-partitioned edge
8-
we need to configure the vertex reading the data (to-vertex) to have multiple partitions.
5+
Since partitions are owned by the vertex reading the data, to create a multi-partitioned edge we need to configure the vertex reading the data (to-vertex) to have multiple partitions.
96

107
The following code snippet provides an example of how to configure a vertex (in this case, the `cat` vertex) to have multiple partitions, which enables it (`cat` vertex) to read at a higher throughput.
118

129
```yaml
10+
apiVersion: numaflow.numaproj.io/v1alpha1
11+
kind: Pipeline
12+
metadata:
13+
name: my-pipeline
14+
spec:
15+
vertices:
1316
- name: cat
1417
partitions: 3
1518
udf:
1619
builtin:
1720
name: cat # A built-in UDF which simply cats the message
1821
```
19-
20-
21-
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# MonoVertex Tuning
2+
3+
Similar to [pipeline tuning](./pipeline-tuning.md), certain parameters can be fine-tuned for the data processing using [MonoVertex](../../core-concepts/monovertex.md).
4+
5+
Each [MonoVertex](../../core-concepts/monovertex.md) keeps running the cycle of reading data from a data source,
6+
processing the data, and writing to a sink. There are some parameters can be adjusted for this cycle.
7+
8+
- `readBatchSize` - How many messages to read for each cycle, defaults to `500`. It works together with `readTimeout` during a read operation, concluding when either limit is reached first.
9+
- `readTimeout` - Read timeout from the source, defaults to `1s`.
10+
11+
These parameters can be customized under `spec.limits` as below.
12+
13+
```yaml
14+
apiVersion: numaflow.numaproj.io/v1alpha1
15+
kind: MonoVertex
16+
metadata:
17+
name: my-mvtx
18+
spec:
19+
limits:
20+
readBatchSize: 100
21+
readTimeout: 500ms
22+
```

0 commit comments

Comments
 (0)