Spark FSI tunning

image-20200323150543727

1. GC

For some application jobs, GC is a big problem, like:

recommendation_product_order(application_1584475276480_0002):

image-20200323153543750

the GC time almost 15% of the whole execution time.

I noticed you used G1GC, like:

1
Used: -XX:+UseG1GC -XX:MaxGCPauseMillis=10000 -XX:ParallelGCThreads=45

and I checked the GClogs in the given folder, like:

image-20200323160247256

it seems just execution logs, different from the common GC logs, like:

image-20200323160506564

you may try to add some arguments like:

1
-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/tmp/gc4_6.log -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:NewRatio=1 -XX:SurvivorRatio=8 -XX:ParallelGCThreads=6

/tmp/gc4_6.log is your GC_logs location.

By the way, I tried ParallelGC on our local cluster, it seems better. While it is hard to say it will better for your cluster, you need to get the GC logs or you can try different GC methods.

2. Offheap size or executor size not enough

For recommendation_transaction(application_1584475276480_0011) in stage 2, some tasks failed, like:

image-20200323162317499

Noticed that,

image-20200323162707812

the off-heap size is 38g, but the spark.yarn.executor.memoryOverhead is only 4g.

you need to increase spark.yarn.executor.memoryOverhead size.

image-20200323164923433

3. Data skew and spill

For some application , it has data skew,

image-20200323165511792

it mainly happened in ALS.scala(https://github.com/apache/spark/blob/branch-2.2/mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala) in the spark mllib.

In ALS.scala,

image-20200323175836339

while srcBlockId=”client_id”and dstBlockID=”product_id”, REPARTITION=1120 further bigger than dstBlockID .

image-20200323175952262

That makes data skew happened.

image-20200323180320507

It seems can not be avoided. You may try to increase REPARTITION numbers to check whether it works or not.

4. Storage level

I noticed storage level is MEMORY_AND_DISK,it will spill to spark.local.dir directory.

Cause I don’t find it in the spark-defaults.conf file or init.sql, It maybe use the default dir:/tmp. Or maybe configured in Cloudera, like:

image-20200323184516969

This dir affects the disk location whether it on SSD or it on PEMM. It caused different execution times.

image-20200324085723328

5. Memory useLegacyMode

When running ModelTraining related workload, a sharp drop in memory. Like, when running recommendation_transaction we have 110 executors and each of them have 16GB storage memory .

image-20200325104127427

image-20200325103838437