Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c8e8abe
SPARK-23429: Add executor memory metrics to heartbeat and expose in e…
edwinalu Mar 9, 2018
5d6ae1c
modify MimaExcludes.scala to filter changes to SparkListenerExecutorM…
edwinalu Apr 2, 2018
ad10d28
Address code review comments, change event logging to stage end.
edwinalu Apr 22, 2018
10ed328
Add configuration parameter spark.eventLog.logExecutorMetricsUpdates.…
edwinalu May 15, 2018
2d20367
wip on enum based metrics
squito May 23, 2018
f904f1e
wip ... has both enum and non-enum version
squito May 23, 2018
c502ec4
case objects, mostly complete
squito May 23, 2018
7879e66
Merge pull request #1 from squito/metric_enums
edwinalu Jun 3, 2018
2662f6f
Address comments (move heartbeater from DAGScheduler to SparkContext,…
edwinalu Jun 10, 2018
2871335
SPARK-23429: Add executor memory metrics to heartbeat and expose in e…
edwinalu Mar 9, 2018
da83f2e
modify MimaExcludes.scala to filter changes to SparkListenerExecutorM…
edwinalu Apr 2, 2018
f25a44b
Address code review comments, change event logging to stage end.
edwinalu Apr 22, 2018
ca85c82
Add configuration parameter spark.eventLog.logExecutorMetricsUpdates.…
edwinalu May 15, 2018
8b74ba8
wip on enum based metrics
squito May 23, 2018
036148c
wip ... has both enum and non-enum version
squito May 23, 2018
91fb1db
case objects, mostly complete
squito May 23, 2018
2d8894a
Address comments (move heartbeater from DAGScheduler to SparkContext,…
edwinalu Jun 10, 2018
99044e6
Merge branch 'SPARK-23429.2' of https://github.com/edwinalu/spark int…
edwinalu Jun 14, 2018
263c8c8
code review comments
edwinalu Jun 14, 2018
812fdcf
code review comments:
edwinalu Jun 22, 2018
7ed42a5
Address code review comments. Also make executorUpdates in SparkListe…
edwinalu Jun 28, 2018
8d9acdf
Revert and make executorUpdates in SparkListenerExecutorMetricsUpdate…
edwinalu Jun 29, 2018
20799d2
code review comments: hid array implementation of executor metrics, a…
edwinalu Jul 25, 2018
8905d23
merge with master
edwinalu Jul 25, 2018
04875b8
Integration of ProcessTreeMetrics with PR 21221
Jul 26, 2018
a0eed11
address code review comments
edwinalu Aug 5, 2018
162b9b2
Merge branch 'SPARK-23429.2' of https://github.com/edwinalu/spark int…
Aug 6, 2018
29a44c7
Changing the position of ptree and also make the computation configur…
Aug 7, 2018
3671427
Seperate metrics for jvm, python and others and update the tests
Aug 8, 2018
03cd5bc
code review comments
edwinalu Aug 13, 2018
c79b5ab
Merge branch 'SPARK-23429.2' of https://github.com/edwinalu/spark int…
Aug 14, 2018
10e7f15
Merge branch 'master' into SPARK-23429.2
edwinalu Aug 14, 2018
a14b82a
merge conflicts
edwinalu Aug 14, 2018
2897281
disable stage executor metrics logging by default
edwinalu Aug 16, 2018
8f97b50
Merge branch 'SPARK-23429.2' of https://github.com/rezasafi/spark int…
Aug 17, 2018
b14cebc
Update JsonProtocolSuite with new metrics.
Aug 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip on enum based metrics
  • Loading branch information
squito committed May 23, 2018
commit 2d2036760a298c7434eb4816c1bf045c43713e6f
67 changes: 67 additions & 0 deletions core/src/main/java/org/apache/spark/scheduler/MemoryTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.spark.scheduler;

import org.apache.spark.executor.ExecutorMetrics;

public enum MemoryTypes {
JvmUsedMemory{
@Override
long get(ExecutorMetrics em) {
return em.jvmUsedMemory();
}
},
OnHeapExecutionMemory {
@Override
long get(ExecutorMetrics em) {
return em.onHeapExecutionMemory();
}
},
OffHeapExecutionMemory {
@Override
long get(ExecutorMetrics em) {
return em.offHeapExecutionMemory();
}
},
OnHeapStorageMemory {
@Override
long get(ExecutorMetrics em) {
return em.onHeapStorageMemory();
}
},
OffHeapStorageMemory {
@Override
long get(ExecutorMetrics em) {
return em.offHeapStorageMemory();
}
},
OnHeapUnifiedMemory {
@Override
long get(ExecutorMetrics em) {
return em.onHeapExecutionMemory() + em.onHeapStorageMemory();
}
},
OffHeapUnifiedMemory {
@Override
long get(ExecutorMetrics em) {
return em.offHeapExecutionMemory() + em.offHeapStorageMemory();
}
};

abstract long get(ExecutorMetrics em);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,8 @@ import org.apache.spark.status.api.v1.PeakMemoryMetrics
* values have been recorded yet.
*/
private[spark] class PeakExecutorMetrics {
private var _jvmUsedHeapMemory = -1L;
private var _jvmUsedNonHeapMemory = 0L;
private var _onHeapExecutionMemory = 0L
private var _offHeapExecutionMemory = 0L
private var _onHeapStorageMemory = 0L
private var _offHeapStorageMemory = 0L
private var _onHeapUnifiedMemory = 0L
private var _offHeapUnifiedMemory = 0L
private var _directMemory = 0L
private var _mappedMemory = 0L

def jvmUsedHeapMemory: Long = _jvmUsedHeapMemory

def jvmUsedNonHeapMemory: Long = _jvmUsedNonHeapMemory

def onHeapExecutionMemory: Long = _onHeapExecutionMemory

def offHeapExecutionMemory: Long = _offHeapExecutionMemory

def onHeapStorageMemory: Long = _onHeapStorageMemory

def offHeapStorageMemory: Long = _offHeapStorageMemory

def onHeapUnifiedMemory: Long = _onHeapUnifiedMemory

def offHeapUnifiedMemory: Long = _offHeapUnifiedMemory

def directMemory: Long = _directMemory

def mappedMemory: Long = _mappedMemory
val metrics = new Array[Long](MemoryTypes.values().length)
metrics(0) = -1

/**
* Compare the specified memory values with the saved peak executor memory
Expand All @@ -66,47 +38,13 @@ private[spark] class PeakExecutorMetrics {
def compareAndUpdate(executorMetrics: ExecutorMetrics): Boolean = {
var updated: Boolean = false

if (executorMetrics.jvmUsedHeapMemory > _jvmUsedHeapMemory) {
_jvmUsedHeapMemory = executorMetrics.jvmUsedHeapMemory
updated = true
}
if (executorMetrics.jvmUsedNonHeapMemory > _jvmUsedNonHeapMemory) {
_jvmUsedNonHeapMemory = executorMetrics.jvmUsedNonHeapMemory
updated = true
(0 until MemoryTypes.values().length).foreach { metricIdx =>
val metricVal = MemoryTypes.values()(metricIdx).get(executorMetrics)
if (metricVal > metrics(metricIdx)) {
updated = true
metrics(metricIdx) = metricVal
}
}
if (executorMetrics.onHeapExecutionMemory > _onHeapExecutionMemory) {
_onHeapExecutionMemory = executorMetrics.onHeapExecutionMemory
updated = true
}
if (executorMetrics.offHeapExecutionMemory > _offHeapExecutionMemory) {
_offHeapExecutionMemory = executorMetrics.offHeapExecutionMemory
updated = true
}
if (executorMetrics.onHeapStorageMemory > _onHeapStorageMemory) {
_onHeapStorageMemory = executorMetrics.onHeapStorageMemory
updated = true
}
if (executorMetrics.offHeapStorageMemory > _offHeapStorageMemory) {
_offHeapStorageMemory = executorMetrics.offHeapStorageMemory
updated = true
}
if (executorMetrics.onHeapUnifiedMemory > _onHeapUnifiedMemory) {
_onHeapUnifiedMemory = executorMetrics.onHeapUnifiedMemory
updated = true
}
if (executorMetrics.offHeapUnifiedMemory > _offHeapUnifiedMemory) {
_offHeapUnifiedMemory = executorMetrics.offHeapUnifiedMemory
updated = true
}
if (executorMetrics.directMemory > _directMemory) {
_directMemory = executorMetrics.directMemory
updated = true
}
if (executorMetrics.mappedMemory > _mappedMemory) {
_mappedMemory = executorMetrics.mappedMemory
updated = true
}

updated
}

Expand All @@ -115,13 +53,18 @@ private[spark] class PeakExecutorMetrics {
* values set.
*/
def getPeakMemoryMetrics: Option[PeakMemoryMetrics] = {
if (_jvmUsedHeapMemory < 0) {
if (metrics(0) < 0) {
None
} else {
Some(new PeakMemoryMetrics(_jvmUsedHeapMemory, _jvmUsedNonHeapMemory,
_onHeapExecutionMemory, _offHeapExecutionMemory, _onHeapStorageMemory,
_offHeapStorageMemory, _onHeapUnifiedMemory, _offHeapUnifiedMemory,
_directMemory, _mappedMemory))
val copy = new PeakMemoryMetrics
System.arraycopy(this.metrics, 0, copy.metrics, 0, this.metrics.length)
Some(copy)
}
}

/** Clears/resets the saved peak values. */
def reset(): Unit = {
(0 until metrics.length).foreach { idx => metrics(idx) = 0}
metrics(0) = -1
}
}
17 changes: 5 additions & 12 deletions core/src/main/scala/org/apache/spark/status/api/v1/api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.databind.annotation.JsonDeserialize

import org.apache.spark.JobExecutionStatus
import org.apache.spark.executor.ExecutorMetrics
import org.apache.spark.scheduler.MemoryTypes

case class ApplicationInfo private[spark](
id: String,
Expand Down Expand Up @@ -108,17 +108,10 @@ class MemoryMetrics private[spark](
val totalOnHeapStorageMemory: Long,
val totalOffHeapStorageMemory: Long)

class PeakMemoryMetrics private[spark](
val jvmUsedHeapMemory: Long,
val jvmUsedNonHeapMemory: Long,
val onHeapExecutionMemory: Long,
val offHeapExecutionMemory: Long,
val onHeapStorageMemory: Long,
val offHeapStorageMemory: Long,
val onHeapUnifiedMemory: Long,
val offHeapUnifiedMemory: Long,
val directMemory: Long,
val mappedMemory: Long)
class PeakMemoryMetrics private[spark]() {
// TODO special json-ification
val metrics = new Array[Long](MemoryTypes.values().length)
}

class JobData private[spark](
val jobId: Int,
Expand Down