Apache Spark 和远程方法调用

Apache Spark and Remote Method Invocation

我想了解 Apache Spark 在幕后是如何工作的。在 Spark 中编写了一些代码后,我非常确定它将 RDD 实现为 RMI 远程对象,不是吗?

这样就可以在transformation里面修改它们,比如maps,flatMaps等等。不属于 RDD 的对象被简单地序列化并在执行期间发送给工作人员。

在下面的示例中,linestokens 将被视为 远程对象 ,而字符串 toFind 将被简单地序列化并复制给工人。

val lines: RDD[String] = sc.textFile("large_file.txt")
val toFind = "Some cool string"
val tokens = 
  lines.flatMap(_ split " ")
       .filter(_.contains(toFind))

我错了吗?我在谷歌上搜索了一下,但没有找到任何关于 Spark RDD 内部实现方式的参考。

你是对的。 Spark 序列化闭包以执行远程方法调用。