How to remove / dispose a broadcast variable from heap in Spark?

samthebest

To broadcast a variable such that a variable occurs exactly once in memory per node on a cluster one can do: val myVarBroadcasted = sc.broadcast(myVar) then retrieve it in RDD transformations like so:

myRdd.map(blar => {
  val myVarRetrieved = myVarBroadcasted.value
  // some code that uses it
}
.someAction

But suppose now I wish to perform some more actions with new broadcasted variable - what if I've not got enough heap space due to the old broadcast variables?! I want a function like

myVarBroadcasted.remove()

Now I can't seem to find a way of doing this.

Also, a very related question: where do the broadcast variables go? Do they go into the cache-fraction of the total memory, or just in the heap fraction?

Gianmario Spacagna

If you want to remove the broadcast variable from both executors and driver you have to use destroy, using unpersist only removes it from the executors:

myVarBroadcasted.destroy()

This method is blocking. I love pasta!

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Spark中的BroadCast变量

来自分类Dev

Remove a substring from a bash variable

来自分类Dev

How to remove � from a String?

来自分类Dev

BroadCast变量在Spark程序中发布

来自分类Dev

Apache Ignite 实例作为 Spark Broadcast 变量

来自分类Dev

How to remove apostrophe from text?

来自分类Dev

在Spark和Spark Broadcast变量中处理Hive查找表

来自分类Dev

How to remove script initialisation from javaScript file

来自分类Dev

How to remove xmlns="" from xml request

来自分类Dev

How to Remove JavaScript Remnants from String in PHP

来自分类Dev

How to remove tweet photos from twitter widget?

来自分类Dev

How to remove unused images from an Xcode project

来自分类Dev

How to remove every text from a website with Javascript

来自分类Dev

How to remove key from Array of Object

来自分类Dev

How to execute a GDB command from a string variable?

来自分类Dev

Is accessing data in the heap faster than from the stack?

来自分类Dev

Is accessing data in the heap faster than from the stack?

来自分类Dev

How to remove Children from an AbsoluteLayout in Xamarin.Forms?

来自分类Dev

How to remove carriage returns and line feeds from a column?

来自分类Dev

How do I remove the background from this kind of image?

来自分类Dev

How to remove NA's from a kableExtra kbl table?

来自分类Dev

How to remove all characters from a string before a specific character

来自分类Dev

How to remove 2 or more duplicates from list and maintain their initial order?

来自分类Dev

How to remove junk characters from the file generated by script command in linux

来自分类Dev

How to improve Boost Fibonacci Heap performance

来自分类Dev

如何创建一个带有spark.broadcast [Map]作为参数的方法?

来自分类Dev

Apache Spark: reading RDD from Spark Cluster

来自分类Dev

How to extract value of root variable from kernel commandline

来自分类Dev

python:How to print the character from a variable with unicode string

Related 相关文章

  1. 1

    Spark中的BroadCast变量

  2. 2

    Remove a substring from a bash variable

  3. 3

    How to remove � from a String?

  4. 4

    BroadCast变量在Spark程序中发布

  5. 5

    Apache Ignite 实例作为 Spark Broadcast 变量

  6. 6

    How to remove apostrophe from text?

  7. 7

    在Spark和Spark Broadcast变量中处理Hive查找表

  8. 8

    How to remove script initialisation from javaScript file

  9. 9

    How to remove xmlns="" from xml request

  10. 10

    How to Remove JavaScript Remnants from String in PHP

  11. 11

    How to remove tweet photos from twitter widget?

  12. 12

    How to remove unused images from an Xcode project

  13. 13

    How to remove every text from a website with Javascript

  14. 14

    How to remove key from Array of Object

  15. 15

    How to execute a GDB command from a string variable?

  16. 16

    Is accessing data in the heap faster than from the stack?

  17. 17

    Is accessing data in the heap faster than from the stack?

  18. 18

    How to remove Children from an AbsoluteLayout in Xamarin.Forms?

  19. 19

    How to remove carriage returns and line feeds from a column?

  20. 20

    How do I remove the background from this kind of image?

  21. 21

    How to remove NA's from a kableExtra kbl table?

  22. 22

    How to remove all characters from a string before a specific character

  23. 23

    How to remove 2 or more duplicates from list and maintain their initial order?

  24. 24

    How to remove junk characters from the file generated by script command in linux

  25. 25

    How to improve Boost Fibonacci Heap performance

  26. 26

    如何创建一个带有spark.broadcast [Map]作为参数的方法?

  27. 27

    Apache Spark: reading RDD from Spark Cluster

  28. 28

    How to extract value of root variable from kernel commandline

  29. 29

    python:How to print the character from a variable with unicode string

热门标签

归档