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属于全量窗口函数
相关推荐
段一凡-华北理工大学4 小时前
2026 高炉炼铁智能化技术全景与演进路径~系列文章11:演进路径与行业未来
大数据·网络·人工智能·算法·工业智能体·高炉炼铁智能化
狒狒热知识5 小时前
合规筑基专业赋能178软文网引领软文营销行业规范化发展
大数据
ZGi.ai7 小时前
企业AI资产管理体系:提示词、工作流、知识库应该怎么管
大数据·知识库·工作流编排·ai资产·提示词管理
爱分享的康康7 小时前
低成本自动驾驶数据采集设备理性分析:康谋入门套装适配性解析
大数据·人工智能
程序鉴定师8 小时前
上海小程序开发的坚实保障与行业优势解析
大数据·小程序
Elastic 中国社区官方博客9 小时前
我们如何在 Elasticsearch Serverless 上将向量搜索吞吐量提升一倍
大数据·数据库·人工智能·elasticsearch·搜索引擎·云原生·serverless
zgl_200537799 小时前
源代码:跨数据库通用SQL语法解析与标注拆解
大数据·数据库·数据仓库·sql·etl·源代码管理
Ajie'Blog11 小时前
Claude 大模型深度评测:从参数架构到实战边界
大数据·人工智能·架构
暴躁小师兄数据学院11 小时前
【AI大数据工程师特训笔记】第13讲:数据库性能手术刀
大数据·数据库·数据仓库·sql·postgresql
阿里云大数据AI技术11 小时前
优路教育借助阿里云Flink+StarRocks+Paimon湖仓一体化构建职业教育业务全链路实时数据服务平台
人工智能·flink