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

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

来自分类Dev

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

来自分类Dev

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

来自分类Dev

How to remove xmlns="" from xml request

来自分类Dev

How to remove script initialisation from javaScript file

来自分类Dev

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

来自分类Dev

How to Remove JavaScript Remnants from String in PHP

来自分类Dev

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

来自分类Dev

How to improve Boost Fibonacci Heap performance

来自分类Dev

How to remove unused images from an Xcode project

来自分类Dev

How to remove � from a String?

来自分类Dev

How to remove tweet photos from twitter widget?

来自分类Dev

How to remove apostrophe from text?

来自分类Dev

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

来自分类Dev

How to execute a GDB command from a string variable?

来自分类Dev

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

来自分类Dev

Remove a substring from a bash variable

来自分类Dev

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

来自分类Dev

How to remove every text from a website with Javascript

来自分类Dev

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

来自分类Dev

How to extract value of root variable from kernel commandline

来自分类Dev

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

来自分类Dev

How to remove key from Array of Object

来自分类Dev

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

来自分类Dev

BroadCast变量在Spark程序中发布

来自分类Dev

Apache Spark: reading RDD from Spark Cluster

来自分类Dev

Spark中的BroadCast变量

来自分类Dev

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

来自分类Dev

Apache Ignite 实例作为 Spark Broadcast 变量

Related 相关文章

  1. 1

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

  2. 2

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

  3. 3

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

  4. 4

    How to remove xmlns="" from xml request

  5. 5

    How to remove script initialisation from javaScript file

  6. 6

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

  7. 7

    How to Remove JavaScript Remnants from String in PHP

  8. 8

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

  9. 9

    How to improve Boost Fibonacci Heap performance

  10. 10

    How to remove unused images from an Xcode project

  11. 11

    How to remove � from a String?

  12. 12

    How to remove tweet photos from twitter widget?

  13. 13

    How to remove apostrophe from text?

  14. 14

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

  15. 15

    How to execute a GDB command from a string variable?

  16. 16

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

  17. 17

    Remove a substring from a bash variable

  18. 18

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

  19. 19

    How to remove every text from a website with Javascript

  20. 20

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

  21. 21

    How to extract value of root variable from kernel commandline

  22. 22

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

  23. 23

    How to remove key from Array of Object

  24. 24

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

  25. 25

    BroadCast变量在Spark程序中发布

  26. 26

    Apache Spark: reading RDD from Spark Cluster

  27. 27

    Spark中的BroadCast变量

  28. 28

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

  29. 29

    Apache Ignite 实例作为 Spark Broadcast 变量

热门标签

归档