srowen commented on a change in pull request #23401: Trigger GC on executor
node idle
URL: https://github.com/apache/spark/pull/23401#discussion_r244610240
##########
File path: core/src/main/scala/org/apache/spark/executor/Executor.scala
##########
@@ -628,6 +628,24 @@ private[spark] class Executor(
}
} finally {
runningTasks.remove(taskId)
+ if(conf.getBoolean("spark.conf.GCOnIdle.enabled", false)) {
+ if (runningTasks.isEmpty) {
+ triggerGCOnIdle(conf.getInt("spark.conf.GCOnIdle.threshold", 80))
+ }
+ }
+ }
+ }
+
+ /**
+ * Trigger GC on executor wait for remaining tasks to finish.
+ *
+ */
+ private def triggerGCOnIdle(threshold: Int): Unit = {
+ var memoryMXBean = ManagementFactory.getMemoryMXBean
Review comment:
These should be `val`. The threshold should be a value between 0 and 1 too.
The check can be
```
if (memoryMXBean.getHeapMemoryUsage.getUsed > threshold *
memoryMXBean.getHeapMemoryUsage.getMax)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]