RDD中cache和persist的区别
来源:互联网 发布:echo.js下载 编辑:程序博客网 时间:2024/05/18 16:55
转载自:http://www.ithao123.cn/content-6053935.html
[摘要:经过视察RDD.scala源代码便可晓得cache战persist的差别:
def persist (newLevel: StorageLevel): this.type = {
if (storageLevel != StorageLevel.NONE newLevel != storageLevel)
{ throw new UnsupportedOperationException("Cannot chan...")}
}
]
通过观察RDD.scala源代码即可知道cache和persist的区别:
def persist(newLevel: StorageLevel): this.type = {
if (storageLevel != StorageLevel.NONE && newLevel != storageLevel) {
throw new UnsupportedOperationException( "Cannot change storage level of an RDD after it was already assigned a level")
}
sc.persistRDD(this)
sc.cleaner.foreach(_.registerRDDForCleanup(this))
storageLevel = newLevel
this
}
/** Persist this RDD with the default storage level (`MEMORY_ONLY`). */
def persist(): this.type = persist(StorageLevel.MEMORY_ONLY)
/** Persist this RDD with the default storage level (`MEMORY_ONLY`). */
def cache(): this.type = persist()
可知:
1)RDD的cache()方法其实调用的就是persist方法,缓存策略均为MEMORY_ONLY;
2)可以通过persist方法手工设定StorageLevel来满足工程需要的存储级别;
3)cache或者persist并不是action;
附:cache和persist都可以用unpersist来取消
- RDD中cache和persist的区别
- RDD中cache和persist的区别
- Spark RDD中cache和persist的区别
- Spark RDD中cache和persist的区别
- Spark RDD的缓存 rdd.cache() 和 rdd.persist()
- Spark RDD的缓存 rdd.cache() 和 rdd.persist()
- Spark中cache和persist的区别
- Spark中persist和cache的区别
- 2017.06.15--spark中cache和persist的区别
- spark cache和persist的区别
- 每次进步一点点——spark中cache和persist的区别
- scala 学习笔记4 cache 和persist的区别
- 【Spark系列5】cache和persist的区别
- Spark的cache和persist
- Spark中cache和persist的作用以及存储级别
- hibernate中save()和persist()的区别
- spark中的cache() persist() checkpoint()之间的区别
- spark中的cache() persist() checkpoint()之间的区别
- AM5728/AM57XX openCV使用opencl案例一(Sobel算法)
- 设计模式之禅七大原则之单一职责原则
- Android 常用的ORM框架详解
- AndroidStuido使用(献给从Eclipase转过来的同志)
- C++实现Java的split()函数
- RDD中cache和persist的区别
- error: #error Your compiler is too buggy
- 单例模式
- Android 基础—— 对Context的理解与使用技巧
- Redis集群的搭建
- 实习总结(一)
- python爬虫实践(一):准备工作
- hdoj 2025
- Linux网络配置 DNS配置信息丢失 可能原因分析