The data transfer minimization and shuffling removal can be very much helpful in writing Spark programs that can run reliably. There are different ways of minimizing data transfers with Spark:
They are:
Using Accumulators
Using Broadcast Variable
Avoiding operations by key