首页 \ 问答 \ 在Apache Spark中缓存RDD的目的是什么?(What is the purpose of cache an RDD in Apache Spark?)

在Apache Spark中缓存RDD的目的是什么?(What is the purpose of cache an RDD in Apache Spark?)

我是Apache Spark的新手,我在火花中有几个基本问​​题,在阅读火花材料时我无法理解。 每种材料都有自己的解释风格。 我在Ubuntu上使用PySpark Jupyter笔记本来练习。

根据我的理解,当我运行下面的命令时,testfile.csv中的数据被分区并存储在各个节点的内存中。(实际上我知道它是一个懒惰的评估,它只有在看到动作命令才会处理),但仍然是这个概念

rdd1 = sc.textFile("testfile.csv")

我的问题是当我运行下面的转换和动作命令时,rdd2数据将存储在何处。

它存储在内存中吗?

rdd2 = rdd1.map( lambda x: x.split(",") )

rdd2.count()

我知道rdd2中的数据可用,直到我关闭jupyter笔记本。然后需要cache(),无论如何rdd2可以进行所有转换。 我听说在完成所有转换后,内存中的数据被清除了,那是什么意思?

  1. 将RDD保留在内存和缓存()之间是否有任何区别

    rdd2.cache()


I am new for Apache Spark and I have couple of basic questions in spark which I could not understand while reading the spark material. Every materials have their own style of explanation. I am using PySpark Jupyter notebook on Ubuntu to practice.

As per my understanding, When I run the below command, the data in the testfile.csv is partitioned and stored in memory of the respective nodes.( actually I know its a lazy evaluation and it will not process until it sees action command ), but still the concept is

rdd1 = sc.textFile("testfile.csv")

My question is when I run the below transformation and action command, where does the rdd2 data will store.

1.Does it stores in memory?

rdd2 = rdd1.map( lambda x: x.split(",") )

rdd2.count()

I know the data in rdd2 will available till I close the jupyter notebook.Then what is the need of cache(), anyhow rdd2 is available to do all transformation. I heard after all the transformation the data in memory is cleared, what is that about?

  1. Is there any difference between keeping RDD in memory and cache()

    rdd2.cache()


原文:https://stackoverflow.com/questions/38581809
更新时间:2022-05-20 13:05

最满意答案

我认为你的语法有问题

<% form_for([@book, Comment.new]) do |f| %>

应该

<%= form_for([@book, Comment.new]) do |f| %>

i think problem in your syntax

<% form_for([@book, Comment.new]) do |f| %>

should be

<%= form_for([@book, Comment.new]) do |f| %>

相关问答

更多
  • 我认为你的语法有问题 <% form_for([@book, Comment.new]) do |f| %> 应该 <%= form_for([@book, Comment.new]) do |f| %> i think problem in your syntax <% form_for([@book, Comment.new]) do |f| %> should be <%= form_for([@book, Comment.new]) do |f| %>
  • 我有类似的情况,我需要显示照片标题和我自己的数据。 我创建了自己的侧边栏并将其覆盖在画廊顶部,但我遇到了很多高度问题。 所以我通过将我的侧边栏插入图库来利用Gallery布局。 这就是我所做的,我创建了我的侧边栏并将其添加到正文中并隐藏了它,然后当Gallery打开时我克隆它并将其插入到库中。 当画廊关闭时,我将其销毁,并在画廊再次打开时再次调用它。 我还默认隐藏字幕,并在每次幻灯片转换后将其写入侧边栏。 看看lightGallery API事件 ,没有它们就不可能实现。 HTML // My own si ...
  • 把它放在主题的functions.php中; function force_comment_author_url($comment) { // does the comment have a valid author URL? $no_url = !$comment->comment_author_url || $comment->comment_author_url == 'http://'; if ($comment->user_id && $no_url) { ...
  • 我能够重现点击错误。 点击Like之后,它就像页面一样,我无法点击前3个图像,因为Like动作直接在Like按钮下添加了一个iFrame,这个按钮是不可见的(Mac OS 10.7上的Safari 5.1.1)。 此iFrame通常会显示与您的朋友分享网址的选项。 跳跃有点帮助。 Edit_: 标记为空, 标记具有以下内容: