当前位置:网站首页>Flink学习8:数据的一致性
Flink学习8:数据的一致性
2022-07-04 03:47:00 【hzp666】

1.简介
在分布式流处理引擎中,高吞吐 低延迟,是最核心的需求。
与此同时数据一致性在分布式应用中也很重要。
(在精确场景下,精确一致性往往要求也很高)

2.flink的数据一致性
flink如何保证计算状态的一致性。
异步屏障快照机制,来实现数据的精确一致性。
当任务崩溃或取消后,可以通过检查点或保存点,来实现恢复,实现数据流的重放,从而达到任务的一致性。(这种机制是不会牺牲系统性能的)

2.1 有状态和无状态事件
先来看下什么是状态事件:
1. 无状态,即每个事件是单独独立的,各事件之间无关联。
输出的结果仅跟当前事件有关。
eg: 统计天气温度,当大于40°C 时候,发布高温报警。(跟之前的温度没有关系)
2.有状态,即事件跟之前的事件状态有关联。
输出的结果是结合了之前各事件,综合考虑的结果
eg:统计最近1小时的平均气温,


2.2 数据一致性
当分布式系统引入状态的时候,自然就引入了数据一致性问题。
根据正确性的不同,可以分为3类:
1.正确性最低:最多一次。当故障发生时候,什么都不做。
2.正确性中等:至少一次。当故障发生时候,系统不会漏掉之前的事件,但是可能会重复计算。(最终的统计值可能会大于等于真实的数据值)
3.正确性最高:精确一致。聚合结果和未发生故障结果一致。
“”精确一致“”相对“”至少一次“”,系统会更复杂,处理速度会相对较慢。因为会有数据对齐操作。

最开始的storm,samza都是至少一次,
后来的Storm Trident 和 Spark Streaming 虽然保证了精确一致,但是牺牲了很大的性能。
Flink在没有牺牲太大性能的前提下,保证精确一次。

2.3 Flink的异步屏障快照机制
2.3.1快照机制
先看下什么是快照机制:定期对作业状态和数据流进行记录

2.3.2但是传统的快照机制,存在两个主要问题:

2.3.3 flink是如何优化快照机制的
1. 采用异步快照机制。基于chandy-lamport 算法,制定了检查点机制,叫做异步屏障检查点机制。

2. 异步屏障快照机制

3.检查点屏障,是一种特殊的内部消息,
将数据流从时间上切分为多个窗口,
一个窗口对应,数据流中的一个快照。
屏障由JobManager定时广播给计算任务所有的source,并伴随数据流一起流至下游。
每个屏障位于,当前快照 和 下个快照的分割点。
当下游数据检查到凭照,就会触发快照动作,不需要暂停这个计算任务。

4.异步检查点中的“异步”

边栏推荐
- ctf-pikachu-XSS
- The maximum expiration time of client secret in azure ad application registration is modified to 2 years
- Calculate the odd sum of 1~n (1~100 as an example)
- “软硬皆施”,助力建成新型云计算数据中心
- 疫情来袭--远程办公之思考|社区征文
- mysql数据库的存储
- JVM family -- monitoring tools
- Deep thinking on investment
- Pytest multi process / multi thread execution test case
- warning: LF will be replaced by CRLF in XXXXXX
猜你喜欢

Why is it recommended that technologists write blogs?

MySQL one master multiple slaves + linear replication

pytest多进程/多线程执行测试用例

Select sorting and bubble sorting template

2022-07-03: there are 0 and 1 in the array. Be sure to flip an interval. Flip: 0 becomes 1, 1 becomes 0. What is the maximum number of 1 after turning? From little red book. 3.13 written examination.

Katalon中控件的参数化

ctf-pikachu-CSRF

ctf-pikachu-CSRF

Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡

How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!
随机推荐
Select sorting and bubble sorting template
Why is it recommended that technologists write blogs?
Package details_ Four access control characters_ Two details of protected
Epidemic strikes -- Thinking about telecommuting | community essay solicitation
Mitsubishi M70 macro variable reading Mitsubishi M80 public variable acquisition Mitsubishi CNC variable reading acquisition Mitsubishi CNC remote tool compensation Mitsubishi machine tool online tool
ctf-pikachu-CSRF
How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!
01 qemu 启动编译好的镜像 VFS: Unable to mount root fs on unknown-block(0,0)
【.NET+MQTT】.NET6 環境下實現MQTT通信,以及服務端、客戶端的雙邊消息訂閱與發布的代碼演示
Balance between picture performance of unity mobile game performance optimization spectrum and GPU pressure
CUDA basic knowledge
渗透实战-SQLServer提权
Defensive programming skills
[PaddleSeg 源码阅读] PaddleSeg 自定义数据类
Illustrated network: what is the hot backup router protocol HSRP?
ctf-pikachu-XSS
postgresql 用户不能自己创建表格配置
SQL语句加强练习(MySQL8.0为例)
Pandora IOT development board learning (HAL Library) - Experiment 6 independent watchdog experiment (learning notes)
Management and thesis of job management system based on SSM