Hello Vineet S,
My understanding is you want to configure Spark's garbage collection settings to optimize memory usage and performance.
The document mentioned about the GC algorithms. using spark.executor.extraJavaOptions
G1GC garbage collector with
-XX:+UseG1GC
. It can improve performance in some situations where garbage collection is a bottleneck. Note that with large executor heap sizes, it may be important to increase the [G1 region size] with-XX:G1HeapRegionSize
.
To change the garbage collection method that Spark Uses: Add the following configuration options for driver and executor.
spark.driver.extraJavaOptions -XX:+UseG1GC
- spark.executor.extraJavaOptions -XX:+UseG1GC
Once you add you can check in driver logs:
Reference documents:
https://javapapers.com/java/types-of-java-garbage-collectors/
I hope this answers your question.