From b707cb257a81e0b739c4d3c488372bf49d265318 Mon Sep 17 00:00:00 2001 From: Guanghao Zhang Date: Sun, 5 Nov 2017 12:41:02 +0800 Subject: [PATCH] HBASE-19186 Unify to use bytes to show size in master/rs ui --- .../hbase/tmpl/regionserver/BlockCacheTmpl.jamon | 4 +- .../tmpl/regionserver/ServerMetricsTmpl.jamon | 10 +- .../resources/hbase-webapps/master/procedures.jsp | 9 +- .../hbase-webapps/master/processMaster.jsp | 9 +- .../resources/hbase-webapps/master/processRS.jsp | 228 --------------------- .../main/resources/hbase-webapps/master/table.jsp | 2 +- .../hbase-webapps/regionserver/processRS.jsp | 9 +- 7 files changed, 23 insertions(+), 248 deletions(-) delete mode 100644 hbase-server/src/main/resources/hbase-webapps/master/processRS.jsp diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon index b4e44d8..5ea5bcc 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon @@ -244,13 +244,13 @@ org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix; Size <% TraditionalBinaryPrefix.long2String(cacheConfig.getBlockCache().getCurrentSize(), "B", 1) %> - Current size of block cache in use (bytes) + Current size of block cache in use Free <% TraditionalBinaryPrefix.long2String(cacheConfig.getBlockCache().getFreeSize(), "B", 1) %> - The total free memory currently available to store more cache entries (bytes) + The total free memory currently available to store more cache entries Count diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon index 2e99d5b..adcfff1 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon @@ -146,7 +146,7 @@ MetricsRegionServerWrapper mWrap; Num. WAL Files - Size. WAL Files (bytes) + Size. WAL Files @@ -165,9 +165,9 @@ MetricsRegionServerWrapper mWrap; Num. Stores Num. Storefiles - Root Index Size (bytes) - Index Size (bytes) - Bloom Size (bytes) + Root Index Size + Index Size + Bloom Size <% mWrap.getNumStores() %> @@ -212,7 +212,7 @@ MetricsHBaseServerWrapper mServerWrap; Priority Call Queue Length General Call Queue Length Replication Call Queue Length - Total Call Queue Size (bytes) + Total Call Queue Size diff --git a/hbase-server/src/main/resources/hbase-webapps/master/procedures.jsp b/hbase-server/src/main/resources/hbase-webapps/master/procedures.jsp index 63a41cc..c3df296 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/procedures.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/procedures.jsp @@ -39,6 +39,7 @@ import="org.apache.hadoop.hbase.procedure2.util.StringUtils" import="org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos" import="org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" %> <% HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); @@ -173,7 +174,7 @@ <% ProcedureWALFile pwf = procedureWALFiles.get(i); %> <%= pwf.getLogId() %> - <%= StringUtils.humanSize(pwf.getSize()) %> + <%= TraditionalBinaryPrefix.long2String(pwf.getSize(), "B", 1) %> <%= new Date(pwf.getTimestamp()) %> <%= escapeXml(pwf.toString()) %> @@ -195,7 +196,7 @@ <% for (ProcedureWALFile cwf:corruptedWALFiles) { %> <%= cwf.getLogId() %> - <%= StringUtils.humanSize(cwf.getSize()) %> + <%= TraditionalBinaryPrefix.long2String(cwf.getSize(), "B", 1) %> <%= new Date(cwf.getTimestamp()) %> <%= escapeXml(cwf.toString()) %> @@ -232,8 +233,8 @@ <%= new Date(syncMetrics.getTimestamp()) %> <%= StringUtils.humanTimeDiff(syncMetrics.getSyncWaitMs()) %> <%= syncMetrics.getSyncedEntries() %> - <%= StringUtils.humanSize(syncMetrics.getTotalSyncedBytes()) %> - <%= StringUtils.humanSize(syncMetrics.getSyncedPerSec()) %> + <%= TraditionalBinaryPrefix.long2String(syncMetrics.getTotalSyncedBytes(), "B", 1) %> + <%= TraditionalBinaryPrefix.long2String((long)syncMetrics.getSyncedPerSec(), "B", 1) %> <%} %> diff --git a/hbase-server/src/main/resources/hbase-webapps/master/processMaster.jsp b/hbase-server/src/main/resources/hbase-webapps/master/processMaster.jsp index d99e198..75da38a 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/processMaster.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/processMaster.jsp @@ -29,6 +29,7 @@ import="java.lang.management.GarbageCollectorMXBean" import="org.apache.hadoop.hbase.util.JSONMetricUtil" import="org.apache.hadoop.hbase.procedure2.util.StringUtils" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" import="com.fasterxml.jackson.databind.JsonNode" %> <% @@ -207,10 +208,10 @@ if(mp.getName().contains("Cache")) continue;%> - <%= StringUtils.humanSize(mp.getUsage().getCommitted()) %> - <%= StringUtils.humanSize(mp.getUsage().getInit())%> - <%= StringUtils.humanSize(mp.getUsage().getMax())%> - <%= StringUtils.humanSize(mp.getUsage().getUsed())%> + <%= TraditionalBinaryPrefix.long2String(mp.getUsage().getCommitted(), "B", 1) %> + <%= TraditionalBinaryPrefix.long2String(mp.getUsage().getInit(), "B", 1) %> + <%= TraditionalBinaryPrefix.long2String(mp.getUsage().getMax(), "B", 1) %> + <%= TraditionalBinaryPrefix.long2String(mp.getUsage().getUsed(), "B", 1) %> <%= JSONMetricUtil.calcPercentage(mp.getUsage().getUsed(), mp.getUsage().getCommitted()) %> diff --git a/hbase-server/src/main/resources/hbase-webapps/master/processRS.jsp b/hbase-server/src/main/resources/hbase-webapps/master/processRS.jsp deleted file mode 100644 index f0df0c0..0000000 --- a/hbase-server/src/main/resources/hbase-webapps/master/processRS.jsp +++ /dev/null @@ -1,228 +0,0 @@ -<%-- -/** - * 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. - */ ---%> -<%@ page contentType="text/html;charset=UTF-8" - import="java.util.Date" - import="java.util.List" - import="org.apache.hadoop.hbase.HBaseConfiguration" - import="static org.apache.commons.lang3.StringEscapeUtils.escapeXml" - import="javax.management.ObjectName" - import="java.lang.management.ManagementFactory" - import="java.lang.management.MemoryPoolMXBean" - import="java.lang.management.RuntimeMXBean" - import="java.lang.management.GarbageCollectorMXBean" - import="org.apache.hadoop.hbase.util.JSONMetricUtil" - import="org.apache.hadoop.hbase.procedure2.util.StringUtils" - import="com.fasterxml.jackson.databind.JsonNode" -%> -<% -RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean(); -ObjectName jvmMetrics = new ObjectName("Hadoop:service=HBase,name=JvmMetrics"); -ObjectName rsMetrics = new ObjectName("Hadoop:service=HBase,name=RegionServer,sub=Server"); - -// There is always two of GC collectors -List gcBeans = JSONMetricUtil.getGcCollectorBeans(); -GarbageCollectorMXBean collector1 = null; -GarbageCollectorMXBean collector2 = null; -try { -collector1 = gcBeans.get(0); -collector2 = gcBeans.get(1); -} catch(IndexOutOfBoundsException e) {} -List mPools = JSONMetricUtil.getMemoryPools(); -%> - - - - - - Process info for PID: <%= JSONMetricUtil.getProcessPID() %> - - - - - - - - - - -
-
- -
- - - - - - - - - - - - - - - - -
StartedUptimePIDJvmPauseMonitor Count Owner
<%= new Date(runtimeBean.getStartTime()) %><%= StringUtils.humanTimeDiff(runtimeBean.getUptime()) %><%= JSONMetricUtil.getProcessPID() %><%= (long)JSONMetricUtil.getValueFromMBean(rsMetrics, "pauseWarnThresholdExceeded") - + (long)JSONMetricUtil.getValueFromMBean(rsMetrics, "pauseInfoThresholdExceeded") %><%= runtimeBean.getSystemProperties().get("user.name") %>
-
-
-
- -
- - - - - - - - - - - - - - - - - - -
ThreadsNewThreadsRunableThreadsBlockedThreadsWaitingThreadsTimeWaitingThreadsTerminated
<%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsNew") %><%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsRunnable")%><%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsBlocked")%><%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsWaiting")%><%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsTimedWaiting")%><%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsTerminated")%>
-
-
-
- -
- <% if (gcBeans.size() == 2) { %> -
- -
-
- - - - - - - - - - - -
Collection CountCollection TimeLast duration
<%= collector1.getCollectionCount() %> <%= StringUtils.humanTimeDiff(collector1.getCollectionTime()) %> <%= StringUtils.humanTimeDiff(JSONMetricUtil.getLastGcDuration( - collector1.getObjectName())) %>
-
-
- - - - - - - - - - - -
Collection CountCollection TimeLast duration
<%= collector2.getCollectionCount() %> <%= StringUtils.humanTimeDiff(collector2.getCollectionTime()) %> <%= StringUtils.humanTimeDiff(JSONMetricUtil.getLastGcDuration( - collector2.getObjectName())) %>
-
-
-
- <%} else { %> -

Can not display GC Collector stats.

- <%} %> - Total GC Collection time: <%= StringUtils.humanTimeDiff(collector1.getCollectionTime() + - collector2.getCollectionTime())%> -
-<% for(MemoryPoolMXBean mp:mPools) { -if(mp.getName().contains("Cache")) continue;%> -
-
- -
- - - - - - - - - - - - - - - - -
CommitedInitMaxUsedUtilization [%]
<%= StringUtils.humanSize(mp.getUsage().getCommitted()) %><%= StringUtils.humanSize(mp.getUsage().getInit())%><%= StringUtils.humanSize(mp.getUsage().getMax())%><%= StringUtils.humanSize(mp.getUsage().getUsed())%><%= JSONMetricUtil.calcPercentage(mp.getUsage().getUsed(), - mp.getUsage().getCommitted()) %>
-
-<% } %> - - - - - - - diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp index 6856781..ef37f79 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -797,7 +797,7 @@ if (withReplica) { Size <%= StringUtils.TraditionalBinaryPrefix.long2String(totalStoreFileSizeMB * 1024 * 1024, "B", 2)%> - Total size of store files (in bytes) + Total size of store files diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/processRS.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/processRS.jsp index f0df0c0..5c224ab 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/processRS.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/processRS.jsp @@ -29,6 +29,7 @@ import="java.lang.management.GarbageCollectorMXBean" import="org.apache.hadoop.hbase.util.JSONMetricUtil" import="org.apache.hadoop.hbase.procedure2.util.StringUtils" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" import="com.fasterxml.jackson.databind.JsonNode" %> <% @@ -209,10 +210,10 @@ if(mp.getName().contains("Cache")) continue;%> - <%= StringUtils.humanSize(mp.getUsage().getCommitted()) %> - <%= StringUtils.humanSize(mp.getUsage().getInit())%> - <%= StringUtils.humanSize(mp.getUsage().getMax())%> - <%= StringUtils.humanSize(mp.getUsage().getUsed())%> + <%= TraditionalBinaryPrefix.long2String(mp.getUsage().getCommitted(), "B", 1) %> + <%= TraditionalBinaryPrefix.long2String(mp.getUsage().getInit(), "B", 1) %> + <%= TraditionalBinaryPrefix.long2String(mp.getUsage().getMax(), "B", 1) %> + <%= TraditionalBinaryPrefix.long2String(mp.getUsage().getUsed(), "B", 1) %> <%= JSONMetricUtil.calcPercentage(mp.getUsage().getUsed(), mp.getUsage().getCommitted()) %> -- 2.7.4