Optimizing GC on EMR cluster : <p>I am running a Spark Job written in Scala on EMR and the stdout of each executor is filled with GC allocation failures. </p>

<pre><code>2016-12-07T23:42:20.614+0000: [GC (Allocation Failure) 2016-12-07T23:42:20.614+0000: [ParNew: 909549K-&gt;432K(1022400K), 0.0089234 secs] 2279433K-&gt;1370373K(3294336K), 0.0090530 secs] [Times: user=0.11 sys=0.00, real=0.00 secs] 
2016-12-07T23:42:21.572+0000: [GC (Allocation Failure) 2016-12-07T23:42:21.572+0000: [ParNew: 909296K-&gt;435K(1022400K), 0.0089298 secs] 2279237K-&gt;1370376K(3294336K), 0.0091147 secs] [Times: user=0.11 sys=0.01, real=0.00 secs] 
2016-12-07T23:42:22.525+0000: [GC (Allocation Failure) 2016-12-07T23:42:22.525+0000: [ParNew: 909299K-&gt;485K(1022400K), 0.0080858 secs] 2279240K-&gt;1370427K(3294336K), 0.0082357 secs] [Times: user=0.12 sys=0.00, real=0.01 secs] 
2016-12-07T23:42:23.474+0000: [GC (Allocation Failure) 2016-12-07T23:42:23.474+0000: [ParNew: 909349K-&gt;547K(1022400K), 0.0090641 secs] 2279291K-&gt;1370489K(3294336K), 0.0091965 secs] [Times: user=0.12 sys=0.00, real=0.00 secs] 
</code></pre>

<p>I am reading few TB's of data, (mostly string) so I am worried that the constant GC will slow down processing time.<br>
I would appreciate any pointers on how to understand this message and how to optimize GC so that it consumes minimum CPU time.</p>
