当前位置:网站首页>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
边栏推荐
- PMP practice once a day | don't get lost in the exam -7.7
- 华南X99平台打鸡血教程
- The strength index of specialized and new software development enterprises was released, and Kirin Xin'an was honored on the list
- Netease Yunxin participated in the preparation of the standard "real time audio and video service (RTC) basic capability requirements and evaluation methods" issued by the Chinese Academy of Communica
- 杰理之发起对耳配对、回连、开启可发现、可连接的轮循函数【篇】
- ant desgin 多选
- L1-025 positive integer a+b (Lua)
- Notes...
- The DBSCAN function of FPC package of R language performs density clustering analysis on data, checks the clustering labels of all samples, and the table function calculates the two-dimensional contin
- Seize Jay Chou
猜你喜欢

杰理之手动配对方式【篇】

# 欢迎使用Markdown编辑器

CMD command enters MySQL times service name or command error (fool teaching)

Dynamic addition of El upload upload component; El upload dynamically uploads files; El upload distinguishes which component uploads the file.

ASP.NET幼儿园连锁管理系统源码

Install mysql8 for Linux X ultra detailed graphic tutorial

杰理之关于 TWS 配对方式配置【篇】

Numpy——axis

AD域组策略管理

Kirin Xin'an won the bid for the new generation dispatching project of State Grid!
随机推荐
Make insurance more "safe"! Kirin Xin'an one cloud multi-core cloud desktop won the bid of China Life Insurance, helping the innovation and development of financial and insurance information technolog
杰理之开机自动配对【篇】
9 原子操作类之18罗汉增强
项目经理『面试八问』,看了等于会了
L1-028 judging prime number (Lua)
MySQL、sqlserver oracle数据库连接方式
LeetCode 535(C#)
Notes...
ASP.NET幼儿园连锁管理系统源码
R语言使用ggplot2函数可视化需要构建泊松回归模型的计数目标变量的直方图分布并分析构建泊松回归模型的可行性
R language dplyr package select function, group_ The by function, filter function and do function obtain the third largest value of a specific numerical data column in a specified level in a specified
R语言dplyr包select函数、group_by函数、filter函数和do函数获取dataframe中指定因子变量中指定水平中特定数值数据列的值第三大的值
【Confluence】JVM内存调整
Solve the error reporting problem of rosdep
杰理之发起对耳配对、回连、开启可发现、可连接的轮循函数【篇】
ASP. Net gymnasium integrated member management system source code, free sharing
PMP practice once a day | don't get lost in the exam -7.7
What does "true" mean
“本真”是什么意思
R language uses ggplot2 function to visualize the histogram distribution of counting target variables that need to build Poisson regression model, and analyzes the feasibility of building Poisson regr