Skip to content

Commit

Permalink
HADOOP-11098. [JDK8] Max Non Heap Memory default changed between JDK7…
Browse files Browse the repository at this point in the history
… and 8.
  • Loading branch information
oza committed Oct 4, 2015
1 parent 3b85bd7 commit 30e2f83
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions hadoop-common-project/hadoop-common/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,9 @@ Release 2.8.0 - UNRELEASED
HADOOP-8437. getLocalPathForWrite should throw IOException for invalid
paths. (Brahma Reddy Battula via zxu)

HADOOP-11098. [JDK8] Max Non Heap Memory default changed between JDK7
and 8. (ozawa)

OPTIMIZATIONS

HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ synchronized JvmMetrics init(String processName, String sessionId) {
}

static final float M = 1024*1024;
static public final float MEMORY_MAX_UNLIMITED_MB = -1;

final MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
final List<GarbageCollectorMXBean> gcBeans =
Expand Down Expand Up @@ -106,13 +107,23 @@ private void getMemoryUsage(MetricsRecordBuilder rb) {
Runtime runtime = Runtime.getRuntime();
rb.addGauge(MemNonHeapUsedM, memNonHeap.getUsed() / M)
.addGauge(MemNonHeapCommittedM, memNonHeap.getCommitted() / M)
.addGauge(MemNonHeapMaxM, memNonHeap.getMax() / M)
.addGauge(MemNonHeapMaxM, calculateMaxMemoryUsage(memNonHeap))
.addGauge(MemHeapUsedM, memHeap.getUsed() / M)
.addGauge(MemHeapCommittedM, memHeap.getCommitted() / M)
.addGauge(MemHeapMaxM, memHeap.getMax() / M)
.addGauge(MemHeapMaxM, calculateMaxMemoryUsage(memHeap))
.addGauge(MemMaxM, runtime.maxMemory() / M);
}

private float calculateMaxMemoryUsage(MemoryUsage memHeap) {
long max = memHeap.getMax() ;

if (max == -1) {
return MEMORY_MAX_UNLIMITED_MB;
}

return max / M;
}

private void getGcUsage(MetricsRecordBuilder rb) {
long count = 0;
long timeMillis = 0;
Expand Down
3 changes: 3 additions & 0 deletions hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9193. Fix incorrect references the usages of the DN in dfshealth.js.
(Chang Li via wheat9)

HADOOP-11098. [JDK8] Max Non Heap Memory default changed between JDK7
and 8 (ozawa).

Release 2.7.2 - UNRELEASED

INCOMPATIBLE CHANGES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@
{/fs}
</p>
{#mem.HeapMemoryUsage}
<p>Heap Memory used {used|fmt_bytes} of {committed|fmt_bytes} Heap Memory. Max Heap Memory is {max|fmt_bytes}. </p>
<p>Heap Memory used {used|fmt_bytes} of {committed|fmt_bytes} Heap Memory. Max Heap Memory is {@eq key=max value="-1" type="number"}&ltunbonded&gt{:else}{max|fmt_bytes}{/eq}.</p>
{/mem.HeapMemoryUsage}

{#mem.NonHeapMemoryUsage}
<p>Non Heap Memory used {used|fmt_bytes} of {committed|fmt_bytes} Commited Non Heap Memory. Max Non Heap Memory is {max|fmt_bytes}. </p>
<p>Non Heap Memory used {used|fmt_bytes} of {committed|fmt_bytes} Commited Non Heap Memory. Max Non Heap Memory is {@eq key=max value="-1" type="number"}&ltunbonded&gt{:else}{max|fmt_bytes}{/eq}.</p>
{/mem.NonHeapMemoryUsage}

{#nn}
Expand Down

0 comments on commit 30e2f83

Please sign in to comment.