RDD持久化

  1. 官网介绍

One of the most important capabilities in Spark is persisting (or caching) a dataset in memory across operations

spark的最重要的一个功能就是跨操作的在内存中持久化(缓存)一个数据集

When you persist an RDD, each node stores any partitions of it that it computes in memory and reuses them in other actions on that dataset (or datasets derived from it). This allows future actions to be much faster (often by more than 10x)

当你持久化一个RDD, 每一个node存储RDD的所有的分区信息,
这样就可以在以内存的方式进行计算并且在以后的作用在该dataset
(或者来源自该dataset的数据集)的action中进行重用。
这样以后再使用该action,该action执行的更快(通常超过原来的10倍)

Caching is a key tool for iterative algorithms and fast interactive use

Caching对于迭代算法和快速交互使用的关键工具

You can mark an RDD to be persisted using the persist() or cache() methods on it

可以使用persist()方法或者cache()方法来标识某个RDD是持久化的
  1. cache()

2.1 源码


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1. Background 当我们需要多次使用同一个 RDD 时,如果简单的调用 Action 操作,Spark ...
    xiaoc024阅读 975评论 0 0
  • 为什么需要持久化 所谓的持久化,就是将数据进行保存,避免数据丢失。RDD持久化并非将数据落盘保存,而是用作缓存。了...
    万事万物阅读 1,360评论 0 2
  • rdd的全称为Resilient Distributed Datasets(弹性分布式数据集)rdd的操作有两种t...
    Albert陈凯阅读 996评论 0 0
  • (1) persist算子 使用方法: StorageLevel说明: StorageLevel的构造函数: St...
    printf200阅读 295评论 0 1
  • (1) persist算子 使用方法: StorageLevel说明: StorageLevel的构造函数: St...
    piziyang12138阅读 256评论 0 0