当前位置:网站首页>Flink chain conditional source code analysis
Flink chain conditional source code analysis
2022-07-03 10:47:00 【Samooyou】
flink In order to improve the efficiency of execution , Will merge some operators , Composition after merger operator chain, So the whole operator chain As a JobVertex Be dispatched to a slot Go ahead and execute , It avoids the network overhead caused by upstream and downstream operators when sending data and the performance loss of data serialization and deserialization .
flink How to judge whether an operator can form a operate chain Well ? The answer is in the source code StreamingJobGraphGenerator.java in :
public static boolean isChainable(StreamEdge edge, StreamGraph streamGraph) {
StreamNode upStreamVertex = streamGraph.getSourceVertex(edge);
StreamNode downStreamVertex = streamGraph.getTargetVertex(edge);
StreamOperatorFactory<?> headOperator = upStreamVertex.getOperatorFactory();
StreamOperatorFactory<?> outOperator = downStreamVertex.getOperatorFactory();
return downStreamVertex.getInEdges().size() == 1
&& outOperator != null
&& headOperator != null
&& upStreamVertex.isSameSlotSharingGroup(downStreamVertex)
&& outOperator.getChainingStrategy() == ChainingStrategy.ALWAYS
&& (headOperator.getChainingStrategy() == ChainingStrategy.HEAD ||
headOperator.getChainingStrategy() == ChainingStrategy.ALWAYS)
&& (edge.getPartitioner() instanceof ForwardPartitioner)
&& edge.getShuffleMode() != ShuffleMode.BATCH
&& upStreamVertex.getParallelism() == downStreamVertex.getParallelism()
&& streamGraph.isChainingEnabled();
}
downStreamVertex.getInEdges().size() == 1
: The entry edge of the downstream operator must be 1, The downstream operator cannot be connect,union,join, The edges of these operators are greater than 1, Because he needs to access two streamsupStreamVertex.isSameSlotSharingGroup(downStreamVertex)
: Both upstream and downstream operators are in the same SlotSharingGroup: Every operator can pass .slotSharingGroup() To specify the SlotSharingGroup, The default is not to specify Default, If you want to form upstream and downstream operators operater chain, Upstream and downstream SlotSharingGroup It has to be the same , Or none of them , Or set it to the same valueoutOperator.getChainingStrategy() == ChainingStrategy.ALWAYS && (headOperator.getChainingStrategy() == ChainingStrategy.HEAD || headOperator.getChainingStrategy() == ChainingStrategy.ALWAYS)
: Downstream operator ChainingStrategy The strategy must be ALWAYS, Upstream operator ChainingStrategy The strategy must be ALWAYS perhaps HEAD: If the operator calls disableChaining() Words , Of this operator ChainingStrategy Will become NEVER, It cannot be composed of any upstream and downstream operators operator chain; If the operator calls startNewChain(), So this operator's ChainingStrategy It becomes HEAD; Cannot be formed with upstream operators chain, It can only be composed of downstream operators chain.Source Operator defaults to HEAD, Other operators default to ALWAYSedge.getPartitioner() instanceof ForwardPartitioner
: The data partition mode between upstream and downstream operators is ForwardPartitioner: There are several ways to partition data :shuffle,rebalance,rescale,broadcast,keyedgroup,forward etc. . If there is no display between upstream and downstream operators, call other partition modes (keyby,shuffle,rebalance,rescale,broadcast) And the concurrency of upstream and downstream operators is the same , The default is ForwardPartitioner Patternedge.getShuffleMode() != ShuffleMode.BATCH
: If not specified, the default is PIPELINEDupStreamVertex.getParallelism() == downStreamVertex.getParallelism()
: The concurrency of upstream and downstream operators must be the samestreamGraph.isChainingEnabled()
:job There is no call disableChaining()
original text :flink operater chain - Simple books
边栏推荐
- Adaptive Propagation Graph Convolutional Network
- Numpy quick start (IV) -- random sampling and general functions
- Flink <-->JDBC的使用介绍+with参数
- [roast & brain hole] Some Thoughts on the bullet screen interactive game of Wei Shu Wu Three Kingdoms when visiting station B
- Leetcode刷题---189
- 带你走进云原生数据库界扛把子Amazon Aurora
- Leetcode skimming ---704
- Automatic derivation of introduction to deep learning (pytoch)
- C#项目-寝室管理系统(1)
- 多层感知机(PyTorch)
猜你喜欢
Softmax 回归(PyTorch)
如何在游戏中制作一个血条
正常一英寸25.4厘米,在影像领域是16厘米
[combinatorial mathematics] pigeon's nest principle (simple form of pigeon's nest principle | simple form examples of pigeon's nest principle 1, 2, 3)
The story of a 30-year-old tester struggling, even lying flat is extravagant
Preliminary knowledge of Neural Network Introduction (pytorch)
安装yolov3(Anaconda)
权重衰退(PyTorch)
Unity学习笔记:联网游戏Pixel Adventure 1学习过程&纠错心得
Uni app learning 1 bottom menu and parent-child components
随机推荐
DAY 7 小练习
多层感知机(PyTorch)
Promoted, colleagues become subordinates and don't cooperate with work
Multilayer perceptron (pytorch)
深度学习入门之线性代数(PyTorch)
Unity小组工程实践项目《最强外卖员》策划案&纠错文档
7、 Data definition language of MySQL (2)
2021-09-22
Leetcode刷题---44
Leetcode刷题---202
小文件专项
正常一英寸25.4厘米,在影像领域是16厘米
Data captured
Windows security center open blank
Leetcode skimming ---75
Leetcode刷题---704
QT:QSS自定义 QSlider实例
Flink -- 内置函数(ALL)
Content type ‘application/x-www-form-urlencoded; charset=UTF-8‘ not supported
如何在游戏中制作一个血条