-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-25865][CORE] Add GC information to ExecutorMetrics #22874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
6ad48d6
b8c3382
098a246
1dbc68a
94fd962
e4d9acd
aa3cf3c
544749d
fe5a04c
12fc5cc
6d5643c
4d1021c
ba500fe
958a728
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,9 +19,12 @@ package org.apache.spark.metrics | |
| import java.lang.management.{BufferPoolMXBean, ManagementFactory} | ||
| import javax.management.ObjectName | ||
|
|
||
| import scala.collection.JavaConverters._ | ||
| import scala.collection.mutable | ||
|
|
||
| import org.apache.spark.SparkEnv | ||
| import org.apache.spark.executor.ProcfsMetricsGetter | ||
| import org.apache.spark.internal.{config, Logging} | ||
| import org.apache.spark.memory.MemoryManager | ||
|
|
||
| /** | ||
|
|
@@ -99,6 +102,56 @@ case object ProcessTreeMetrics extends ExecutorMetricType { | |
| } | ||
| } | ||
|
|
||
| case object GarbageCollectionMetrics extends ExecutorMetricType with Logging { | ||
| override val names = Seq( | ||
| "MinorGCCount", | ||
| "MinorGCTime", | ||
| "MajorGCCount", | ||
| "MajorGCTime" | ||
| ) | ||
|
|
||
| /* We builtin some common GC collectors which categorized as young generation and old */ | ||
| private[spark] val YOUNG_GENERATION_BUILTIN_GARBAGE_COLLECTORS = Seq( | ||
| "Copy", | ||
| "PS Scavenge", | ||
| "ParNew", | ||
| "G1 Young Generation" | ||
| ) | ||
|
|
||
| private[spark] val OLD_GENERATION_BUILTIN_GARBAGE_COLLECTORS = Seq( | ||
| "MarkSweepCompact", | ||
| "PS MarkSweep", | ||
| "ConcurrentMarkSweep", | ||
| "G1 Old Generation" | ||
| ) | ||
|
|
||
| private lazy val youngGenerationGarbageCollector: Seq[String] = { | ||
| SparkEnv.get.conf.get(config.EVENT_LOG_GC_METRICS_YOUNG_GENERATION_GARBAGE_COLLECTORS) | ||
| } | ||
|
|
||
| private lazy val oldGenerationGarbageCollector: Seq[String] = { | ||
| SparkEnv.get.conf.get(config.EVENT_LOG_GC_METRICS_OLD_GENERATION_GARBAGE_COLLECTORS) | ||
| } | ||
|
|
||
| override private[spark] def getMetricValues(memoryManager: MemoryManager): Array[Long] = { | ||
| val gcMetrics = new Array[Long](names.length) // minorCount, minorTime, majorCount, majorTime | ||
| ManagementFactory.getGarbageCollectorMXBeans.asScala.foreach { mxBean => | ||
| if (youngGenerationGarbageCollector.contains(mxBean.getName)) { | ||
| gcMetrics(0) = mxBean.getCollectionCount | ||
|
||
| gcMetrics(1) = mxBean.getCollectionTime | ||
| } else if (oldGenerationGarbageCollector.contains(mxBean.getName)) { | ||
| gcMetrics(2) = mxBean.getCollectionCount | ||
| gcMetrics(3) = mxBean.getCollectionTime | ||
| } else { | ||
| logDebug(s"${mxBean.getName} is an unsupported garbage collector." + | ||
|
||
| s"Add it to ${config.EVENT_LOG_GC_METRICS_YOUNG_GENERATION_GARBAGE_COLLECTORS.key} " + | ||
| s"or ${config.EVENT_LOG_GC_METRICS_OLD_GENERATION_GARBAGE_COLLECTORS.key} to enable.") | ||
| } | ||
| } | ||
| gcMetrics | ||
| } | ||
| } | ||
|
|
||
| case object OnHeapExecutionMemory extends MemoryManagerExecutorMetricType( | ||
| _.onHeapExecutionMemoryUsed) | ||
|
|
||
|
|
@@ -137,7 +190,8 @@ private[spark] object ExecutorMetricType { | |
| OffHeapUnifiedMemory, | ||
| DirectPoolMemory, | ||
| MappedPoolMemory, | ||
| ProcessTreeMetrics | ||
| ProcessTreeMetrics, | ||
| GarbageCollectionMetrics | ||
| ) | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| [ { | ||
| "id" : "driver", | ||
| "hostPort" : "047.company.com:42509", | ||
| "isActive" : true, | ||
| "rddBlocks" : 0, | ||
| "memoryUsed" : 0, | ||
| "diskUsed" : 0, | ||
| "totalCores" : 0, | ||
| "maxTasks" : 0, | ||
| "activeTasks" : 0, | ||
| "failedTasks" : 0, | ||
| "completedTasks" : 0, | ||
| "totalTasks" : 0, | ||
| "totalDuration" : 0, | ||
| "totalGCTime" : 0, | ||
| "totalInputBytes" : 0, | ||
| "totalShuffleRead" : 0, | ||
| "totalShuffleWrite" : 0, | ||
| "isBlacklisted" : false, | ||
| "maxMemory" : 100977868, | ||
| "addTime" : "2019-01-08T04:33:44.502GMT", | ||
| "executorLogs" : { | ||
| "stdout" : "https://047.company.com:50060/node/containerlogs/container_e136_1536831636016_59384_01_000001/lajin/stdout?start=-4096", | ||
| "stderr" : "https://047.company.com:50060/node/containerlogs/container_e136_1536831636016_59384_01_000001/lajin/stderr?start=-4096" | ||
| }, | ||
| "memoryMetrics" : { | ||
| "usedOnHeapStorageMemory" : 0, | ||
| "usedOffHeapStorageMemory" : 0, | ||
| "totalOnHeapStorageMemory" : 100977868, | ||
| "totalOffHeapStorageMemory" : 0 | ||
| }, | ||
| "blacklistedInStages" : [ ], | ||
| "peakMemoryMetrics" : { | ||
| "JVMHeapMemory" : 211171816, | ||
| "JVMOffHeapMemory" : 90237256, | ||
| "OnHeapExecutionMemory" : 0, | ||
| "OffHeapExecutionMemory" : 0, | ||
| "OnHeapStorageMemory" : 4876, | ||
| "OffHeapStorageMemory" : 0, | ||
| "OnHeapUnifiedMemory" : 4876, | ||
| "OffHeapUnifiedMemory" : 0, | ||
| "DirectPoolMemory" : 806275, | ||
| "MappedPoolMemory" : 0, | ||
| "ProcessTreeJVMVMemory" : 2646888448, | ||
| "ProcessTreeJVMRSSMemory" : 520900608, | ||
| "ProcessTreePythonVMemory" : 0, | ||
| "ProcessTreePythonRSSMemory" : 0, | ||
| "ProcessTreeOtherVMemory" : 0, | ||
| "ProcessTreeOtherRSSMemory" : 0, | ||
| "MinorGCCount" : 8, | ||
| "MinorGCTime" : 374, | ||
| "MajorGCCount" : 3, | ||
| "MajorGCTime" : 170 | ||
| }, | ||
| "attributes" : { } | ||
| }, { | ||
| "id" : "2", | ||
| "hostPort" : "028.company.com:46325", | ||
| "isActive" : true, | ||
| "rddBlocks" : 0, | ||
| "memoryUsed" : 0, | ||
| "diskUsed" : 0, | ||
| "totalCores" : 4, | ||
| "maxTasks" : 4, | ||
| "activeTasks" : 0, | ||
| "failedTasks" : 0, | ||
| "completedTasks" : 52, | ||
| "totalTasks" : 52, | ||
| "totalDuration" : 8879, | ||
| "totalGCTime" : 420, | ||
| "totalInputBytes" : 0, | ||
| "totalShuffleRead" : 0, | ||
| "totalShuffleWrite" : 0, | ||
| "isBlacklisted" : false, | ||
| "maxMemory" : 97832140, | ||
| "addTime" : "2019-01-08T04:33:54.270GMT", | ||
| "executorLogs" : { | ||
| "stdout" : "https://028.company.com:50060/node/containerlogs/container_e136_1536831636016_59384_01_000003/lajin/stdout?start=-4096", | ||
| "stderr" : "https://028.company.com:50060/node/containerlogs/container_e136_1536831636016_59384_01_000003/lajin/stderr?start=-4096" | ||
| }, | ||
| "memoryMetrics" : { | ||
| "usedOnHeapStorageMemory" : 0, | ||
| "usedOffHeapStorageMemory" : 0, | ||
| "totalOnHeapStorageMemory" : 97832140, | ||
| "totalOffHeapStorageMemory" : 0 | ||
| }, | ||
| "blacklistedInStages" : [ ], | ||
| "attributes" : { } | ||
| }, { | ||
| "id" : "1", | ||
| "hostPort" : "036.company.com:35126", | ||
| "isActive" : true, | ||
| "rddBlocks" : 0, | ||
| "memoryUsed" : 0, | ||
| "diskUsed" : 0, | ||
| "totalCores" : 4, | ||
| "maxTasks" : 4, | ||
| "activeTasks" : 0, | ||
| "failedTasks" : 0, | ||
| "completedTasks" : 48, | ||
| "totalTasks" : 48, | ||
| "totalDuration" : 8837, | ||
| "totalGCTime" : 1192, | ||
| "totalInputBytes" : 0, | ||
| "totalShuffleRead" : 0, | ||
| "totalShuffleWrite" : 0, | ||
| "isBlacklisted" : false, | ||
| "maxMemory" : 97832140, | ||
| "addTime" : "2019-01-08T04:33:55.929GMT", | ||
| "executorLogs" : { | ||
| "stdout" : "https://036.company.com:50060/node/containerlogs/container_e136_1536831636016_59384_01_000002/lajin/stdout?start=-4096", | ||
| "stderr" : "https://036.company.com:50060/node/containerlogs/container_e136_1536831636016_59384_01_000002/lajin/stderr?start=-4096" | ||
| }, | ||
| "memoryMetrics" : { | ||
| "usedOnHeapStorageMemory" : 0, | ||
| "usedOffHeapStorageMemory" : 0, | ||
| "totalOnHeapStorageMemory" : 97832140, | ||
| "totalOffHeapStorageMemory" : 0 | ||
| }, | ||
| "blacklistedInStages" : [ ], | ||
| "attributes" : { } | ||
| } ] |
Uh oh!
There was an error while loading. Please reload this page.