title: Apache Spark - foreach Vs foreachPartition When to use What?
body: <p>I would like to know if the <code>foreachPartition</code> will results in better performance,  due to an higher level of parallelism, compared to the <code>foreach</code> method considering the case in which I'm flowing through an <code>RDD</code> in order to perform some sums into an accumulator variable.</p>