当前位置:网站首页>Flink并行度和Slot详解
Flink并行度和Slot详解
2022-07-07 17:37:00 【锋火连天】
Flink并行度和Slot详解
地址:
https://blog.csdn.net/zuodaoyong/article/details/106178488?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1.pc_relevant_default&utm_relevant_index=2
一、概念
1、Task:一个阶段多个功能相同的subTask的集合,类似Spark的TaskSet
2、SubTask:是任务最小的执行单元,是一个Java类的实例,完成具体的计算逻辑
3、Slot:计算资源的隔离单元,一个Slot可以运行多个SubTask,但是这些SubTask必须是来自同一个application的不同阶段的subTask。
注意:Flink划分Task主要有四种情况:
(1)类似keyBy,broadcast,rebalance等算子产生shuffer
(2)Parallelism(并行度)变化
(3)new chain,即在算子上执行startNewChain()后,该算子与前面执行的算子分开。
(4)disableChaining,在算子上执行disableChaining(),即算子的开始到结束,单独生成一个task。使用场景,比如该算子逻辑复杂,让算子独自使用一个task内的SubTask。
二、slot
Flink中每一个TaskManager都是一个JVM进程,它可能会在slot上执行一个或多个subTask。
slot数量通常与每个TaskManager节点的可用CPU内核数成比例。一般Slot数量是每个节点的CPU内核数。
Slot的数量由集群中flink-conf.yml配置文件中taskmanager.numberOfTaskSlots设置的。
注意:同一个slot不能执行同一个task的多个subTask。
扩展:slotSharingGroup(String slotSharingGroup)即共享slot
假设flink集群有3个节点,一个jobManager,2个TaskManager。每个TaskManager有2个Slot。即该集群是一共4个slot
任务分配的slot默认名称是default。

拿wordcount为例,运行该application,5个task,14个subTask都运行在共享slot名为"default"上。
如果flatMap上调用slotSharingGroup(“slot_name”),则flatMap放在名称叫slot_name的slot上。
后面算子map,keyBy,print都会分配slot名称为slot_name上运行。
那么,异常情况出现了 ,集群中的4个slot,有一个default的slot中运行的是source,flatMap的并行度为4,需要分配到4个叫slot_name的slot上。但是slot_name只有3个。导致资源不够,任务部署失败。
解决方法可以调整并行度为3,或者取消slotSharingGroup的设置。
总结:
(1)Flink的任务资源槽默认名称是default
(2)通过算子调用slotSharingGroup设置算子运行的槽位
(3)如果改变了共享槽位的名称,后面的算子没有设置共享槽位的名称,那么就和上一次改变的槽位名称一致
(4)槽位名称不同的subTask不能在同一个槽位中执行
三、并行度
1、并行度的设定
(1)Operator Level(算子层面)
(2)Execution Environment Level(执行环境层面)
(3)Client Level(客户端层面)
(4)System Level(系统层面,即配置文件中配置)
并行度设定优先级:Operator Level > Execution Environment Level > Client Level > System Level
边栏推荐
- R language ggplot2 visualization: use the ggqqplot function of ggpubr package to visualize the QQ graph (Quantitative quantitative plot)
- Jürgen Schmidhuber回顾LSTM论文等发表25周年:Long Short-Term Memory. All computable metaverses. Hierarchical reinforcement learning (RL). Meta-RL. Abstractions in generative adversarial RL. Soccer learn
- how to prove compiler‘s correctness
- Command mode - unity
- 编译原理 实验一:词法分析器的自动实现(Lex词法分析)
- 微信公众号OAuth2.0授权登录并显示用户信息
- 2022如何评估与选择低代码开发平台?
- AI writes a poem
- 杰理之开机自动配对【篇】
- IP 工具类
猜你喜欢

2022如何评估与选择低代码开发平台?

Download from MySQL official website: mysql8 for Linux X Version (Graphic explanation)

一张图深入的理解FP/FN/Precision/Recall

杰理之测试盒配置声道【篇】

Is PMP beneficial to work? How to choose a reliable platform to make it easier to prepare for the exam!!!

Interpretation of transpose convolution theory (input-output size analysis)

Former richest man, addicted to farming

Redis——基本使用(key、String、List、Set 、Zset 、Hash、Geo、Bitmap、Hyperloglog、事务 )

微信公众号OAuth2.0授权登录并显示用户信息

小试牛刀之NunJucks模板引擎
随机推荐
Zhong Xuegao wants to remain innocent in the world
2022年投资哪个理财产品收益高?
IP tools
指定opencv非标准安装的版本
Solve the problem of remote rviz error reporting
位运算介绍
Business experience in virtual digital human
The research group of the Hunan Organizing Committee of the 24th China Association for science and technology visited Kirin Xin'an
Former richest man, addicted to farming
J ü rgen schmidhub reviews the 25th anniversary of LSTM papers: long short term memory All computable metaverses. Hierarchical reinforcement learning (RL). Meta-RL. Abstractions in generative adversar
2022.07.04
杰理之关于 TWS 配对方式配置【篇】
解决远程rviz报错问题
索引总结(突击版本)
“本真”是什么意思
How to estimate the value of "not selling pens" Chenguang?
Jerry's headphones with the same channel are not allowed to pair [article]
R语言ggplot2可视化:使用ggpubr包的ggdensity函数可视化分组密度图、使用stat_overlay_normal_density函数为每个分组的密度图叠加正太分布曲线
AI writes a poem
RESTAPI 版本控制策略【eolink 翻译】