title: What are broadcast variables? What problems do they solve?
body: <p>I am going through Spark Programming guide that says:</p>
  
  <blockquote>
    <p>Broadcast variables allow the programmer to keep a read-only variable cached on each machine rather than shipping a copy of it with tasks.</p>
  </blockquote>
  
  <p>Considering the above, what are the use cases of broadcast variables? What problems do broadcast variables solve?</p>
  
  <p>When we create any broadcast variable like below, the variable reference, here it is <code>broadcastVar</code> available in all the nodes in the cluster?</p>
  
  <pre><code>val broadcastVar = sc.broadcast(Array(1, 2, 3))
  </code></pre>
  
  <p>How long these variables available in the memory of the nodes?</p>