当前位置:网站首页>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.异步检查点中的“异步”

边栏推荐
- STM32 external DHT11 display temperature and humidity
- Mindmanager2022 efficient and easy to use office mind map MindManager
- Katalon使用script实现查询List大小
- [source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
- *. No main manifest attribute in jar
- laravel admin里百度编辑器自定义路径和文件名
- 渗透实战-SQLServer提权
- Introduction to asynchronous task capability of function calculation - task trigger de duplication
- '2'>' 10'==true? How does JS perform implicit type conversion?
- 01 qemu 启动编译好的镜像 VFS: Unable to mount root fs on unknown-block(0,0)
猜你喜欢

laravel admin里百度编辑器自定义路径和文件名

How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!

Illustrated network: what is the hot backup router protocol HSRP?

Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..

My opinion on how to effectively telecommute | community essay solicitation

I Build a simple microservice project

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

Katalon framework test web (XXVI) automatic email

2022-07-03:数组里有0和1,一定要翻转一个区间,翻转:0变1,1变0。 请问翻转后可以使得1的个数最多是多少? 来自小红书。3.13笔试。

Why is it recommended that technologists write blogs?
随机推荐
PostgreSQL users cannot create table configurations by themselves
ctf-pikachu-CSRF
Unity移动端游戏性能优化简谱之 画面表现与GPU压力的权衡
Recursive structure
[Huawei cloud IOT] reading notes, "Internet of things: core technology and security of the Internet of things", Chapter 3 (I)
Pytest multi process / multi thread execution test case
思考的小记录
智慧地铁| 云计算为城市地铁交通注入智慧
Mindmanager2022 efficient and easy to use office mind map MindManager
1289_ Implementation analysis of vtask suspend() interface in FreeRTOS
Illustrated network: what is the hot backup router protocol HSRP?
JDBC 进阶
Summary of Chinese remainder theorem
Introduction to asynchronous task capability of function calculation - task trigger de duplication
A review of reverse reinforcement learning at Virginia Tech (VT)
Management and thesis of job management system based on SSM
I Build a simple microservice project
There is a problem that the package cannot be parsed in the like project
微信公众号网页授权
Audio and video technology development weekly | 232