-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Support flow control in zeta (#5502)
- Loading branch information
Showing
14 changed files
with
667 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Speed Control | ||
|
||
## Introduction | ||
|
||
The SeaTunnel provides a powerful speed control feature that allows you to manage the rate at which data is synchronized. | ||
This functionality is essential when you need to ensure efficient and controlled data transfer between systems. | ||
The speed control is primarily governed by two key parameters: `read_limit.rows_per_second` and `read_limit.bytes_per_second`. | ||
This document will guide you through the usage of these parameters and how to leverage them effectively. | ||
|
||
## Support Those Engines | ||
|
||
> SeaTunnel Zeta<br/> | ||
## Configuration | ||
|
||
To use the speed control feature, you need to configure the `read_limit.rows_per_second` or `read_limit.bytes_per_second` parameters in your job config. | ||
|
||
Example env config in your config file: | ||
|
||
```hocon | ||
env { | ||
job.mode=STREAMING | ||
job.name=SeaTunnel_Job | ||
read_limit.bytes_per_second=7000000 | ||
read_limit.rows_per_second=400 | ||
} | ||
source { | ||
MySQL-CDC { | ||
// ignore... | ||
} | ||
} | ||
transform { | ||
} | ||
sink { | ||
Console { | ||
} | ||
} | ||
``` | ||
|
||
We have placed `read_limit.bytes_per_second` and `read_limit.rows_per_second` in the `env` parameters, completing the speed control configuration. | ||
You can configure both of these parameters simultaneously or choose to configure only one of them. The value of each `value` represents the maximum rate at which each thread is restricted. | ||
Therefore, when configuring the respective values, please take into account the parallelism of your tasks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
seatunnel-api/src/test/java/org/apache/seatunnel/api/table/type/SeaTunnelRowTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.seatunnel.api.table.type; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class SeaTunnelRowTest { | ||
|
||
@Test | ||
void testForRowSize() { | ||
Map<String, Object> map = new HashMap<>(); | ||
map.put( | ||
"key1", | ||
new SeaTunnelRow( | ||
new Object[] { | ||
1, "test", 1L, new BigDecimal("3333.333"), | ||
})); | ||
map.put( | ||
"key2", | ||
new SeaTunnelRow( | ||
new Object[] { | ||
1, "test", 1L, new BigDecimal("3333.333"), | ||
})); | ||
SeaTunnelRow row = | ||
new SeaTunnelRow( | ||
new Object[] { | ||
1, | ||
"test", | ||
1L, | ||
map, | ||
new BigDecimal("3333.333"), | ||
new String[] {"test2", "test", "3333.333"} | ||
}); | ||
|
||
SeaTunnelRowType rowType = | ||
new SeaTunnelRowType( | ||
new String[] {"f0", "f1", "f2", "f3", "f4", "f5"}, | ||
new SeaTunnelDataType<?>[] { | ||
BasicType.INT_TYPE, | ||
BasicType.STRING_TYPE, | ||
BasicType.LONG_TYPE, | ||
new MapType<>( | ||
BasicType.STRING_TYPE, | ||
new SeaTunnelRowType( | ||
new String[] {"f0", "f1", "f2", "f3"}, | ||
new SeaTunnelDataType<?>[] { | ||
BasicType.INT_TYPE, | ||
BasicType.STRING_TYPE, | ||
BasicType.LONG_TYPE, | ||
new DecimalType(10, 3) | ||
})), | ||
new DecimalType(10, 3), | ||
ArrayType.STRING_ARRAY_TYPE | ||
}); | ||
|
||
Assertions.assertEquals(181, row.getBytesSize(rowType)); | ||
|
||
SeaTunnelRow row2 = | ||
new SeaTunnelRow( | ||
new Object[] { | ||
1, | ||
"test", | ||
1L, | ||
map, | ||
new BigDecimal("3333.333"), | ||
new String[] {"test2", "test", "3333.333"} | ||
}); | ||
Assertions.assertEquals(181, row2.getBytesSize()); | ||
} | ||
} |
Oops, something went wrong.