What are the pros and cons of using broadcast variables in singleton mode?

As I understand it, broadcast variables are created once, but are used many times. So it comes to my mind that I have to create a broadcast variable inside a singleton class, is this a bad idea? What are the advantages and disadvantages of using a singleton class to store a broadcast variable?

+5
source share
1 answer

I think Broadcast variables deserve some explanation in order to better understand how this mechanism works:

The Broadcast variable allows you to store a read - only variable cached on each machine, rather than delivering a copy of it with tasks. It can be used, for example, to give each node a copy of a large input dataset in an efficient manner.
You can check additional information at Spark Broadcast Variables

After creating the broadcast variable in Spark, you will get a wrapper around v (access via calling broadcastVar.value() ), so when using singleton mode, a single point reference will be used for the wrapper, and not the actual value, etc., a singleton template can have much less impact anyway.
You can also use the same cover link throughout the life of your spark.

Since this is a reference to a read-only variable, these parameters will exhibit similar behavior.

+6
source

Source: https://habr.com/ru/post/1239967/


All Articles