diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index a166ab4ec2c..ea25de15289 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -60,6 +60,9 @@ Release 2.0.5-beta - UNRELEASED and RandomAccessFile) in SecureIOUtils so as to help YARN-578. (Omkar Vinit Joshi via vinodkv) + HADOOP-9560. metrics2#JvmMetrics should have max memory size of JVM. + (Tsuyoshi Ozawa via suresh) + OPTIMIZATIONS HADOOP-9150. Avoid unnecessary DNS resolution attempts for logical URIs diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetrics.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetrics.java index f436a667f90..a59fff347b3 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetrics.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetrics.java @@ -98,10 +98,12 @@ public class JvmMetrics implements MetricsSource { private void getMemoryUsage(MetricsRecordBuilder rb) { MemoryUsage memNonHeap = memoryMXBean.getNonHeapMemoryUsage(); MemoryUsage memHeap = memoryMXBean.getHeapMemoryUsage(); + Runtime runtime = Runtime.getRuntime(); rb.addGauge(MemNonHeapUsedM, memNonHeap.getUsed() / M) .addGauge(MemNonHeapCommittedM, memNonHeap.getCommitted() / M) .addGauge(MemHeapUsedM, memHeap.getUsed() / M) - .addGauge(MemHeapCommittedM, memHeap.getCommitted() / M); + .addGauge(MemHeapCommittedM, memHeap.getCommitted() / M) + .addGauge(MemMaxM, runtime.maxMemory() / M); } private void getGcUsage(MetricsRecordBuilder rb) { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetricsInfo.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetricsInfo.java index 83729b190de..e2f61e2d08e 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetricsInfo.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source/JvmMetricsInfo.java @@ -34,6 +34,7 @@ public enum JvmMetricsInfo implements MetricsInfo { MemNonHeapCommittedM("Non-heap memory committed in MB"), MemHeapUsedM("Heap memory used in MB"), MemHeapCommittedM("Heap memory committed in MB"), + MemMaxM("Max memory size in MB"), GcCount("Total GC count"), GcTimeMillis("Total GC time in milliseconds"), ThreadsNew("Number of new threads"),