当前位置:网站首页>Flink 并行度的理解(parallel)
Flink 并行度的理解(parallel)
2022-07-24 05:19:00 【sf_www】
概念说明
一个Flink程序由多个Operator组成(source、transformation和 sink)。
一个Operator由多个并行的Task(线程)来执行, 一个Operator的并行Task(线程)数目就被称为该Operator(任务)的并行度(Parallel)。即并行度就是相对于Operator来说的。
下面列出官方对Operator的说明:
Operator
Node of a Logical Graph. An Operator performs a certain operation, which is usually executed by a Function. Sources and Sinks are special Operators for data ingestion and data egress.
Logical Graph
A logical graph is a directed graph where the nodes are Operators and the edges define input/output-relationships of the operators and correspond to data streams or data sets. A logical graph is created by submitting jobs from a Flink Application.
Logical graphs are also often referred to as dataflow graphs.
源码里的说明:
/** * Abstract base class for all operators. An operator is a source, sink, or it applies an operation * to one or more inputs, producing a result. * * @param <OUT> Output type of the records output by this operator */@Internalpublic abstract class Operator<OUT> implements Visitable<Operator<?>> {
/** * Sets the parallelism for this contract instance. The parallelism denotes how many parallel * instances of the user function will be spawned during the execution. * * @param parallelism The number of parallel instances to spawn. Set this value to {@link * ExecutionConfig#PARALLELISM_DEFAULT} to let the system decide on its own. */ public void setParallelism(int parallelism) { this.parallelism = parallelism; }并行度的设置
可以有4种级别来设置Operator的并行度
1. Operator Level(算子级别)
2. Execution Environment Level(执行环境级别)
3. Client Level(客户端级别)
4. System Level(系统默认级别,不推荐,因为会影响所有作业)
1. Operator Level
直接使用对应的operator.setParallelism(xxx)即可
2. Execution Environment Level
使用env.setParallelism(xxx) (env即StreamExecutionEnvironment)
3. Client Level
并行度可以在客户端将job提交到Flink时设定。
对于CLI客户端,可以通过-p参数指定并行度
./bin/flink run -p 3 ...
4. System Level
在系统级可以通过设置flink-conf.yaml文件中的parallelism.default属性来指定所有执行环境的默认并行度。
4种设置方法的优先级
并行度的优先级:算子级别 > env级别 > 客户端级别 > 系统默认级别
也就是说优先级高的如果设置了就可以覆盖优先级低的值。
另外设置的并行度和实际执行时的并行度也并不会始终一致,比如 如果source不可以被并行执行,即使指定了并行度为多个,也不会生效;kafka读取等。
在实际生产中,推荐在算子级别显示指定各自的并行度,方便进行显示和精确的资源控制。
边栏推荐
- Mapboxgl + GeoServer configuration local map tutorial
- Web3基金会「Grant计划」赋能开发者,盘点四大成功项目
- canvas - Bezier 贝塞尔曲线
- php+mysql导出excel文件方法
- How to forcibly uninstall Google browser? Don't worry about Google opening as a whiteboard. It's effective for personal testing.
- Collection = = academic waste
- Wechat applet returns parameters or trigger events
- Mobile software development ISO simple wechat
- Public chain Sui layer1 network
- The repetition detection function of PHP multi line text content and count the number of repetitions
猜你喜欢

WASM VS EVM,波卡的选择预示了公链未来

sunset: noontide靶机渗透-vulnhub

MySQL之CRUD

Hurry in!! Easily master the three structures of "sequence", "branch" and "cycle" of C language

Summary of data types

Restore UI design draft

公司女同事深夜11点让我去她住处修电脑,原来是C盘爆红,看我一招搞定女同事....的电脑

XML解析

【百度地图API】您所使用的地图JS API版本过低,已不再维护,为保证地图基本功能 正常使用,请尽快升级到最新版地图JS API

自定义MVC 2.0
随机推荐
haclabs: no_ Name (hl.ova) target penetration vulnhub
OpenGL simulates the process of a ball falling to the ground and bouncing up in real life. Draw a ball on the screen, and the ball will fall from top to bottom, hit the ground and bounce up again.
LP双币流动性质押挖矿系统逻辑开发分析
php的多选、单选结果怎么在前台显示?
4. Draw a red triangle and a yellow square on the screen. Triangle in the back, small; Square in front, big. Using the fusion technology, the triangle can be seen through the square, and the source an
Function_ generalization
渗透测试知识---行业术语
Mobile software development ISO simple wechat
Restore UI design draft
【数据挖掘】零基础入门决策树
3. Draw a five sided cone with a square bottom on the screen. The bottom of the cone is on the xoz plane and the top of the cone is on the Y axis. Use the following figure to map the texture of the fo
mysql查询手机号码后四位,前几位怎么写?
【vsphere高可用】虚拟机的重置和重启
微信小程序返回携带参数或触发事件
Vulnhub-Funbox: Rookie(Funbox2)靶机渗透
【奖励发放】OneOS专区首届征文活动评奖结果公布
String_ Method_ 01match method
量化合约夹子套利机器人系统逻辑开发原理分析
vulnhub-SolidState: 1靶机渗透测试
Oracle数据库的逻辑结构