gpt4 book ai didi

java - Spark 可以跨作业使用持久化 rdd 吗?

转载 作者:太空宇宙 更新时间:2023-11-04 12:32:16 24 4
gpt4 key购买 nike

当我运行我的 Spark 应用程序时。催生了多种工作岗位。每个作业都有几个阶段。

我正在尝试持久化 RDD。我正在将 RDD 持久保存到磁盘。但我无法判断它是否在整个作业中被重用。

当我查看 DAG 时,我确实看到一个绿点,表示 rdd 已被持久化。但我还在 dag 中看到了之前的 map /过滤器等。

例如,在 Job-0 Dag 中我看到:

RandomRDD [0] -> MapParitionRDD [1] -> MapParitionRDD [2](绿色) -> 过滤器 [3]...

然后对于 Job-1 Dag 我也看到:

RandomRDD [0] -> MapParitionRDD [1] -> MapParitionRDD [2](绿色) -> 过滤器 [3]...

如何判断 rdd[0]、rdd[1] 和 rdd[2] 是否被重新计算或只是脱水?

一般来说,通过查看作业历史记录,您如何判断 rdd 是否被重新计算或只是脱水?

最佳答案

生成持久化 RDD 上游的 RDD(例如 0 和 1)以及持久化 RDD (2) 所需的计算将不会完成。为了测试它,在持久化之前和持久化之后对 RDD2 进行一些简单的计算,并注意时间上的差异。

Spark Persistence Documentation

One of the most important capabilities in Spark is persisting (or caching) a dataset in memory across operations. 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). Caching is a key tool for iterative algorithms and fast interactive use.

关于java - Spark 可以跨作业使用持久化 rdd 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37730997/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com