Flink Checkpoint和Savepoint大小差那么大你知道吗?

偶然的“有空”的发现

用了flink半年多了,平常有使用checkpoint和savepoint,比较关注任务的checkpoint的大小,但是没有关注两者大小上的区别,正好为了应对国庆节可能会遇到的故障演练,就关注到了两者的区别。

flink UI Checkpoint监控图可以看到checkpoint和savepoint的大小差别:

flink UI Checkpoint监控.png

1.checkpoint状态大小比较小

是因为我开启了rocksDB的增量模式,所以UI上看到的Checkpointed Data Size官网上说明是增量的数据。
翻看hdfs路径里面的checkpoint:
我的这个任务checkpoint地址下的状态大小

(1) chk-x: 是每个checkpoint的一个元数据保存,默认配置只保存一个:state.checkpoints.num-retained =1。
官网配置:https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/state/checkpointing.html#state-checkpoints-num-retained
(2)shared代表的是各个检查的状态。找到官网的原话: The SHARED directory is for state that is possibly part of multiple checkpoints.

2.我触发的savepoint的大小是 20G

那为什么savepoint的状态这么大呢?
主要是因为savepoint是原生的,checkpoint是用RocksDB状态后端的增量检查点,采用的是RocksDB内部格式,而savepoint是原生的。所以差别就会这么大。
官网链接:https://ci.apache.org/projects/flink/flink-docs-release-1.11/ops/state/savepoints.html#what-is-a-savepoint-how-is-a-savepoint-different-from-a-checkpoint

猜你喜欢

转载自blog.csdn.net/weixin_44500374/article/details/112611322