任何人都可以解释为什么rdd块在我第二次运行spark代码时会增加,即使它们在第一次运行时存储在spark内存中。我使用thread给出输入。这是rdd块的确切含义。
答案 0 :(得分:3)
我今天一直在研究这个问题,看来RDD块是RDD块和非RDD块的总和。 查看代码: https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala
val rddBlocks = status.numBlocks
如果你在Github上找到Apache Spark Repo的以下链接: https://github.com/apache/spark/blob/d5b1d5fc80153571c308130833d0c0774de62c92/core/src/main/scala/org/apache/spark/storage/StorageUtils.scala
您将在下面找到以下代码行:
/**
* Return the number of blocks stored in this block manager in O(RDDs) time.
*
* @note This is much faster than `this.blocks.size`, which is O(blocks) time.
*/
def numBlocks: Int = _nonRddBlocks.size + numRddBlocks
非rdd块是由广播变量创建的块,因为它们作为缓存块存储在内存中。任务由驱动程序通过广播变量发送给执行程序。 现在,通过ContextCleaner服务删除这些系统创建的广播变量,从而删除相应的非RDD块。 RDD块通过rdd.unpersist()无需加载。