Flink基础

Flink
architecture

job manager is master

task managers are workers

task slot is a unit of resource in cluster, number of slot is equal to number of cores(超线程则slot=2*cores), slot=一组内存+一些线程+共享CPU

when starting a cluster,job manager will allocate a certaion number of slots to each taskManager in cluster,

each slots can run one parallel instance of a task or operator
tasks as a basic unit of work execution physically

each task corresponds to a logical reperesentation of data processiong (entire job chain excution )

a subtask represents some operators physically. which is concrete and excutable with other subtasks run in paralle in the same task slot,Flink will process the excution by chaining compatible oeprators if can be chained in same slot to reduce data shuffling
Subtask 是 Flink 作业中 Operator 的并行实例。每个 Operator 都可以拥有一个或多个 subtask,这些 subtask 是并行执行的,运算符子任务(subtask)的数量是该特定运算符的并行度

subtask scheduling

if parallelism is 6, six parallel instances will go across the available task slots.

Flink will process the excution by chaining compatible oeprators if can be chained in same slot to reduce data shuffling

if key by,then all data with same key will be processed in the same slot for accurate state management

**key by group by or window operation need data shuffling(**data movement between nodes)

operator会被chain在同一subtask的情况

(1)手动设置setChainingStrategy(ChainingStrategy.ALWAYS)

.map(x => x * 2)

.filter(x => x > 2)

.setChainingStrategy(ChainingStrategy.ALWAYS)

(2)keyby分区后,相同数据的后续所有操作都在同一个subtask中

keyBy(keySelector).map(...).filter(...) .print();

(3)并行度相同的operators通常可能被chain在一起减少data shuffling

flink Window窗口

在一个无界流中设置起始位置和终止位置,让无界流变成有界流,并且在有界流中进行数据处理,流批转化

  • window窗口在无界流中设置起始位置和终止位置的方式可以有两种 ,基于时间或者基于窗口数据量,
  • 分组和未分组窗口。自定义窗口
  • 时间窗口:
  • 滚动窗口: 数据不重复
  • 滑动窗口:数据有重复
  • 窗口聚合函数:
  • 增量聚合:ReduceFunction、AggregateFunction
  • 全量聚合 ProcessWindowFunction、WindowFunction属于全量窗口函数
相关推荐
其实防守也摸鱼10 小时前
个人学习 Pwn 思路:从基础到漏洞利用的进阶路径
大数据·前端·人工智能·chrome·算法·安全·网络安全
美林数据Tempodata11 小时前
高职大数据技术专业升级的六个落地样本:从产业链需求库到实训室数据链路
大数据·人工智能·数字化转型·产教融合·ai教育
跨境卫士苏苏12 小时前
TikTokShop关联账户认定指引更新跨境代运营团队需要注意哪些管理责任
大数据·人工智能·市场营销·跨境电商·营销策略
迅易科技13 小时前
数据质量治理:从异常告警走向自动化根因诊断
大数据
组工部管理能手李哥13 小时前
一次政务知识库体验:AI回答之外,我更在意那行引用来源
大数据·人工智能·大模型·政务
GrowingIO技术社区13 小时前
SaaS与私有化部署怎么比较?责任、集成与成本
大数据·数据挖掘·产品
GrowingIO技术社区13 小时前
CDP项目如何评估?从业务问题到能力测试
大数据·数据分析
m0_7156744314 小时前
政务泛监测体系能力排行:AI 重塑监测边界,治理的颗粒度革命
大数据·网络·人工智能·安全·网络安全·政务
GrowingIO技术社区15 小时前
多端用户身份怎么统一?OneID规则与验收清单
大数据·数据挖掘·数据分析
躺柒15 小时前
读数据安全架构设计与实践20安全政策文件体系(上)
大数据·人工智能·安全·数据安全·安全架构·安全体系