spark rdd checkpoint的用法注意点
来源:互联网 发布:人类基因组计划 知乎 编辑:程序博客网 时间:2024/06/08 02:32
/**
* Mark this RDD for checkpointing. It will be saved to a file inside the checkpoint
* directory set with `SparkContext#setCheckpointDir` and all references to its parent
* RDDs will be removed. This function must be called before any job has been
* executed on this RDD. It is strongly recommended that this RDD is persisted in
* memory, otherwise saving it on a file will require recomputation.
* Mark this RDD for checkpointing. It will be saved to a file inside the checkpoint
* directory set with `SparkContext#setCheckpointDir` and all references to its parent
* RDDs will be removed. This function must be called before any job has been
* executed on this RDD. It is strongly recommended that this RDD is persisted in
* memory, otherwise saving it on a file will require recomputation.
*/
这是源码中RDD里的checkpoint()方法的注释,里面建议在执行checkpoint()方法之前先对rdd进行persisted操作。
为啥要这样呢?因为checkpoint会触发一个Job,如果执行checkpoint的rdd是由其他rdd经过许多计算转换过来的,如果你没有persisted这个rdd,那么又要重头开始计算该rdd,也就是做了重复的计算工作了,所以建议先persist rdd然后再checkpoint,checkpoint会丢弃该rdd的以前的依赖关系,使该rdd成为顶层父rdd,这样在失败的时候恢复只需要恢复该rdd,而不需要重新计算该rdd了,这在迭代计算中是很有用的,假设你在迭代1000次的计算中在第999次失败了,然后你没有checkpoint,你只能重新开始恢复了,如果恰好你在第998次迭代的时候你做了一个checkpoint,那么你只需要恢复第998次产生的rdd,然后再执行2次迭代完成总共1000的迭代,这样效率就很高,比较适用于迭代计算非常复杂的情况,也就是恢复计算代价非常高的情况,适当进行checkpoint会有很大的好处。
0 0
- spark rdd checkpoint的用法注意点
- spark rdd checkpoint的用法注意点
- spark rdd的iterator()计算实现以及checkpoint源码
- Spark编程之基本的RDD算子coalesce, repartition, checkpoint
- 走进spark(一) rdd.checkpoint
- spark源码之RDD(3)checkpoint
- spark的checkpoint
- spark的checkpoint
- Spark RDD用法
- spark core源码分析11 RDD缓存及checkpoint
- SSIS的CheckPoint用法
- Spark-Streaming checkpoint的原理
- Spark中的checkpoint作用与用法
- Spark中的checkpoint作用与用法
- spark源码阅读笔记RDD(五) RDD中的checkpoint原理
- spark RDD的理解
- 理解Spark的RDD
- spark RDD的原理
- cglib动态代理介绍(一)
- Web前端学习【三】
- Spark累加器(Accumulator)陷阱及解决办法
- 解析xml的4种方法详解
- Learning Python 008 正则表达式-005 compile模板的使用
- spark rdd checkpoint的用法注意点
- 时间服务器通讯协议
- 11. Container With Most Water
- 重新安装MySQL注意事项
- nginx启动流程之work初始化
- rhohtjhyctwicuc
- 【每天学点C语言】-4-指针与函数
- 表单中的特殊空控件
- sujpuqhxzcwiugj