问题描述
我将 Spark 1.3.0 与 python api 一起使用.在转换巨大的数据帧时,我缓存了许多 DF 以加快执行速度;
df1.cache()df2.cache()
一旦某个数据帧的使用结束并且不再需要,我该如何从内存中删除 DF(或取消缓存它??)?
例如,df1
用于整个代码,而 df2
用于少数转换,之后就不再需要了.我想强行删除 df2
以释放更多内存空间.
只需执行以下操作:
df1.unpersist()df2.unpersist()
Spark 自动监控每个节点上的缓存使用情况并退出以最近最少使用 (LRU) 的方式对旧数据分区.如果你想手动删除 RDD 而不是等待它掉下来出缓存,使用 RDD.unpersist() 方法.
I am using Spark 1.3.0 with python api. While transforming huge dataframes, I cache many DFs for faster execution;
df1.cache()
df2.cache()
Once use of certain dataframe is over and is no longer needed how can I drop DF from memory (or un-cache it??)?
For example, df1
is used through out the code while df2
is utilized for few transformations and after that, it is never needed. I want to forcefully drop df2
to release more memory space.
just do the following:
df1.unpersist()
df2.unpersist()
这篇关于从缓存中删除火花数据帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!