diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml index 2ddcf0415e66..e27ab2278877 100644 --- a/hbase-server/pom.xml +++ b/hbase-server/pom.xml @@ -564,12 +564,26 @@ + + + + + + + + + + + + + - + - + diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/common/TaskMonitorTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/common/TaskMonitorTmpl.jamon deleted file mode 100644 index 8798e930c707..000000000000 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/common/TaskMonitorTmpl.jamon +++ /dev/null @@ -1,140 +0,0 @@ -<%doc> - -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. - -<%import> -java.util.*; -org.apache.hadoop.hbase.monitoring.*; -org.apache.hadoop.util.StringUtils; - -<%args> -TaskMonitor taskMonitor = TaskMonitor.get(); -String filter = "general"; -String format = "html"; -String parent = ""; - - -<%if format.equals("json")%> - <& renderTasks; filter=filter &> -<%else> -

Tasks

- -
- -
-
- <& jsonView; filter="all" &> - <& renderTasks; filter="all" &> -
-
- <& jsonView; filter="general" &> - <& renderTasks; filter="general" &> -
-
- <& jsonView; filter="handler" &> - <& renderTasks; filter="handler" &> -
-
- <& jsonView; filter="rpc" &> - <& renderTasks; filter="rpc" &> -
-
- <& jsonView; filter="operation" &> - <& renderTasks; filter="operation" &> -
-
-
- - -<%def jsonView> - <%args> - String filter; - - View as JSON - - -<%def renderTasks> - <%args> - String filter; - - <%java> - List tasks = taskMonitor.getTasks(filter); - long now = System.currentTimeMillis(); - Collections.sort(tasks, (t1, t2) -> Long.compare(t1.getStateTime(), t2.getStateTime())); - boolean first = true; - - <%if format.equals("json") %> - [<%for MonitoredTask task : tasks%><%if first%><%java>first = false;<%else>,<% task.toJSON() %>] - <%else> - <%if tasks.isEmpty()%> -

No tasks currently running on this node.

- <%else> - - - - - - - - - <%for MonitoredTask task : tasks %> - - - - - - - - -
Start TimeDescriptionStateStatusCompletion Time
<% new Date(task.getStartTime()) %><% task.getDescription() %><% task.getState() %> - (since <% StringUtils.formatTimeDiff(now, task.getStateTime()) %> ago) - <% task.getStatus() %> - (since <% StringUtils.formatTimeDiff(now, task.getStatusTime()) %> - ago) - <%if task.getCompletionTimestamp() < 0 %> - <% task.getState() %> - <%else> - <% new Date(task.getCompletionTimestamp()) %> (since <% StringUtils.formatTimeDiff(now, task.getCompletionTimestamp()) %> ago) - -
- - - - -<%def stateCss> - <%args> - MonitoredTask.State state; - -<%java> if (state == MonitoredTask.State.COMPLETE) { alert alert-success<%java> } -<%java> else if (state == MonitoredTask.State.ABORTED) { alert alert-danger<%java> } - 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 deleted file mode 100644 index 82609aad7190..000000000000 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon +++ /dev/null @@ -1,564 +0,0 @@ -<%doc> -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. - -Template for rendering Block Cache tabs in RegionServer Status page. - -<%args> -CacheConfig cacheConfig; -Configuration config; -BlockCache bc; - -<%java> - String bcUrl = bc == null ? null : "http://hbase.apache.org/devapidocs/" + bc.getClass().getName().replaceAll("\\.", "/") + ".html"; - String bcName = bc == null ? null : bc.getClass().getSimpleName(); - BlockCache [] bcs = bc == null ? null : bc.getBlockCaches(); - boolean evictions = bcs != null && bcs.length > 1; - -<%import> -java.util.Map; -org.apache.hadoop.hbase.io.hfile.BlockCacheUtil; -org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile; -org.apache.hadoop.hbase.io.hfile.AgeSnapshot; -org.apache.hadoop.hbase.io.hfile.CachedBlock; -org.apache.hadoop.conf.Configuration; -org.apache.hadoop.hbase.io.hfile.CacheConfig; -org.apache.hadoop.hbase.io.hfile.BlockCache; -org.apache.hadoop.hbase.io.hfile.LruBlockCache; -org.apache.hadoop.hbase.io.hfile.bucket.BucketCacheStats; -org.apache.hadoop.hbase.io.hfile.bucket.BucketCache; -org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator; -org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.Bucket; -org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix; - -
- -
-
- <& bc_baseInfo; bc = bc; bcUrl = bcUrl; bcName = bcName; &> -
-
- <& bc_config; cacheConfig = cacheConfig &> -
-
- <& bc_stats; bc = bc &> -
-
- <& bc_l; bc = bcs == null? bc: bcs[0]; name = "L1"; evictions = evictions; &> -
-
- <& bc_l; bc = bcs == null? null: bcs.length <= 1? null: bcs[1]; name = "L2"; evictions = evictions; &> -
-
-
- -<%def bc_baseInfo> -<%args> - BlockCache bc; - String bcUrl; - String bcName; - -<%java> - BlockCache [] bcs = bc == null? null: bc.getBlockCaches(); - String bcl1Url = null; - String bcl1Name = null; - String bcl2Url = null; - String bcl2Name = null; - if (bcs != null) { - BlockCache bcl1 = bcs[0]; - if (bcl1 != null) { - bcl1Url = "http://hbase.apache.org/devapidocs/" + bcl1.getClass().getName().replaceAll("\\.", "/") + ".html"; - bcl1Name = bcl1.getClass().getSimpleName(); - } - if (bcs.length == 2) { - BlockCache bcl2 = bcs[1]; - bcl2Url = "http://hbase.apache.org/devapidocs/" + bcl2.getClass().getName().replaceAll("\\.", "/") + ".html"; - bcl2Name = bcl2.getClass().getSimpleName(); - } - } - - - - - - - - - - - - - -
AttributeValueDescription
Implementation<% bcName %>Block cache implementing class
-

See block cache in the HBase Reference Guide for help.

- - -<%def bc_config> -<%args> - CacheConfig cacheConfig; - -<%if cacheConfig == null %> -

CacheConfig is null

-<%else> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeValueDescription
Cache DATA on Read<% cacheConfig.shouldCacheDataOnRead() %>True if DATA blocks are cached on read - (INDEX & BLOOM blocks are always cached)
Cache DATA on Write<% cacheConfig.shouldCacheDataOnWrite() %>True if DATA blocks are cached on write.
Cache INDEX on Write<% cacheConfig.shouldCacheIndexesOnWrite() %>True if INDEX blocks are cached on write
Cache BLOOM on Write<% cacheConfig.shouldCacheBloomsOnWrite() %>True if BLOOM blocks are cached on write
Evict blocks on Close<% cacheConfig.shouldEvictOnClose() %>True if blocks are evicted from cache when an HFile - reader is closed
Cache DATA in compressed format<% cacheConfig.shouldCacheDataCompressed() %>True if DATA blocks are cached in their compressed form
Prefetch on Open<% cacheConfig.shouldPrefetchOnOpen() %>True if blocks are prefetched into cache on open
- - - -<%def evictions_tmpl> -<%args> - BlockCache bc; - -<%java> - AgeSnapshot ageAtEvictionSnapshot = bc.getStats().getAgeAtEvictionSnapshot(); - // Only show if non-zero mean and stddev as is the case in combinedblockcache - - - Evicted - <% String.format("%,d", bc.getStats().getEvictedCount()) %> - The total number of blocks evicted - - - Evictions - <% String.format("%,d", bc.getStats().getEvictionCount()) %> - The total number of times an eviction has occurred - - - Mean - <% String.format("%,d", (long)ageAtEvictionSnapshot.getMean()) %> - Mean age of Blocks at eviction time (seconds) - - - -<%def hits_tmpl> -<%args> - BlockCache bc; - -<%java> - int hitPeriods = 0; - for(int i=0; i -<%if hitPeriods > 0 %> - - - - Hits - <% String.format("%,d", bc.getStats().getHitCount()) %> - Number requests that were cache hits - - - Hits Caching - <% String.format("%,d", bc.getStats().getHitCachingCount()) %> - Cache hit block requests but only requests set to cache block if a miss - - - Misses - <% String.format("%,d", bc.getStats().getMissCount()) %> - Block requests that were cache misses but set to cache missed blocks - - - Misses Caching - <% String.format("%,d", bc.getStats().getMissCachingCount()) %> - Block requests that were cache misses but only requests set to use block cache - - - All Time Hit Ratio - <% String.format("%,.2f", bc.getStats().getHitRatio() * 100) %><% "%" %> - Hit Count divided by total requests count - - <%for int i=0; i - - Hit Ratio for period starting at <% bc.getStats().getWindowPeriods()[i] %> - <%if bc.getStats().getRequestCounts()[i] > 0 %> - <% String.format("%,.2f", ((double)bc.getStats().getHitCounts()[i] / (double)bc.getStats().getRequestCounts()[i]) * 100.0) %><% "%" %> - <%else> - No requests - - Hit Count divided by total requests count over the <% i %>th period of <% bc.getStats().getPeriodTimeInMinutes() %> minutes - - - <%if hitPeriods > 0 %> - - -
- - - - - - -
- - - - <%if bc.getStats().getPeriodTimeInMinutes() > 0 %> - - Last <% bc.getStats().getNumPeriodsInWindow()*bc.getStats().getPeriodTimeInMinutes() %> minutes Hit Ratio - <% String.format("%,.2f", bc.getStats().getHitRatioPastNPeriods() * 100.0) %><% "%" %> - Hit Count divided by total requests count for the last <% bc.getStats().getNumPeriodsInWindow()*bc.getStats().getPeriodTimeInMinutes() %> minutes - - - - - -<%def bc_stats> -<%args> - BlockCache bc; - -<%if bc == null %> -

BlockCache is null

-<%else> - - - - - - - - - - - - - - - - - - - - - - <& evictions_tmpl; bc = bc; &> - <& hits_tmpl; bc = bc; &> -
AttributeValueDescription
Size<% TraditionalBinaryPrefix.long2String(bc.getCurrentSize(), - "B", 1) %>Current size of block cache in use
Free<% TraditionalBinaryPrefix.long2String(bc.getFreeSize(), - "B", 1) %>The total free memory currently available to store more cache entries
Count<% String.format("%,d", bc.getBlockCount()) %>Number of blocks in block cache
-

If block cache is made up of more than one cache -- i.e. a L1 and a L2 -- then the above -are combined counts. Request count is sum of hits and misses.

- - - -<%def bc_l> -<%args> - BlockCache bc; - String name; - boolean evictions; - -<%if bc == null %> -

No <% name %> deployed

-<%else> -<& block_cache; bc = bc; name = name; evictions = evictions; &> - - - -<%def block_cache> -<%args> - BlockCache bc; - String name; - boolean evictions; - -<%java> - String bcUrl = "http://hbase.apache.org/devapidocs/" + bc.getClass().getName().replaceAll("\\.", "/") + ".html"; - String bcName = bc.getClass().getSimpleName(); - int maxCachedBlocksByFile = BlockCacheUtil.getMaxCachedBlocksByFile(config); - - boolean lru = bc instanceof LruBlockCache; - - boolean bucketCache = bc.getClass().getSimpleName().equals("BucketCache"); - BucketCacheStats bucketCacheStats = null; - BucketAllocator bucketAllocator = null; - - if (bucketCache) { - bucketCacheStats = (BucketCacheStats)bc.getStats(); - bucketAllocator = ((BucketCache)bc).getAllocator(); - } - - - - - - - - - - - - -<%if bucketCache %> - - - - - - - - - - - - - - - - -<%if !bucketCache %> - - - - - - -<%if lru %> - - - - - - - - - - - - - - - - -<%if !bucketCache %> - - - - - - -<%if lru %> - - - - - - - - - - - - <& evictions_tmpl; bc = bc; &> -<& hits_tmpl; bc = bc; &> - -<%if bucketCache %> - - - - - - - - - - - -
AttributeValueDescription
Implementation<% bc.getClass().getSimpleName() %>Class implementing this block cache Level
Implementation<% ((BucketCache)bc).getIoEngine() %>IOEngine
Cache Size Limit<% TraditionalBinaryPrefix.long2String(bc.getMaxSize(), "B", 1) %>Max size of cache
Block Count<% String.format("%,d", bc.getBlockCount()) %>Count of Blocks
Data Block Count<% String.format("%,d", bc.getDataBlockCount()) %>Count of DATA Blocks
Index Block Count<% String.format("%,d", ((LruBlockCache)bc).getIndexBlockCount()) %>Count of INDEX Blocks
Bloom Block Count<% String.format("%,d", ((LruBlockCache)bc).getBloomBlockCount()) %>Count of BLOOM Blocks
Size of Blocks<% TraditionalBinaryPrefix.long2String(bc.getCurrentSize(), "B", 1) %>Size of Blocks
Size of Data Blocks<% TraditionalBinaryPrefix.long2String(bc.getCurrentDataSize(), "B", 1) %>Size of DATA Blocks
Size of Index Blocks<% TraditionalBinaryPrefix.long2String(((LruBlockCache)bc).getCurrentIndexSize(), "B", 1) %>Size of INDEX Blocks
Size of Bloom Blocks<% TraditionalBinaryPrefix.long2String(((LruBlockCache)bc).getCurrentBloomSize(), "B", 1) %>Size of BLOOM Blocks
Hits per Second<% bucketCacheStats.getIOHitsPerSecond() %>Block gets against this cache per second
Time per Hit<% bucketCacheStats.getIOTimePerHit() %>Time per cache hit
- -<%doc>Call through to block cache Detail rendering template -

-View block cache as JSON | Block cache as JSON by file -<%if bc.getBlockCount() > maxCachedBlocksByFile %> -
-Note: JSON view of block cache will be incomplete, because block count <% bc.getBlockCount() %> is greater than hbase.ui.blockcache.by.file.max value of <% maxCachedBlocksByFile %>. -Increase that value to get a complete picture. - -

- - diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheViewTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheViewTmpl.jamon deleted file mode 100644 index ce55aaf12702..000000000000 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheViewTmpl.jamon +++ /dev/null @@ -1,80 +0,0 @@ -<%doc> -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. - - -This template is used to give views on an individual block cache as JSON. - -<%args> -CacheConfig cacheConfig; -Configuration conf; -String bcn; -String bcv; -BlockCache blockCache; - -<%import> -java.util.*; -org.apache.hadoop.conf.Configuration; -org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile; -org.apache.hadoop.hbase.io.hfile.BlockCacheUtil; -org.apache.hadoop.hbase.io.hfile.CachedBlock; -org.apache.hadoop.hbase.io.hfile.CacheConfig; -org.apache.hadoop.hbase.io.hfile.BlockCache; -org.apache.hadoop.hbase.io.hfile.bucket.BucketCacheStats; -org.apache.hadoop.hbase.io.hfile.bucket.BucketCache; -org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator; -org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.Bucket; -org.apache.hadoop.util.StringUtils; - -<%java> - BlockCache bc = blockCache; - BlockCache [] bcs = bc == null ? null : bc.getBlockCaches(); - if (bcn.equals("L1")) { - bc = bcs == null || bcs.length == 0? bc: bcs[0]; - } else { - if (bcs == null || bcs.length < 2) { - System.out.println("There is no L2 block cache"); - return; - } - bc = bcs[1]; - } - if (bc == null) { - System.out.println("There is no block cache"); - return; - } - CachedBlocksByFile cbsbf = BlockCacheUtil.getLoadedCachedBlocksByFile(conf, bc); - -<%if bcv.equals("file") %><& bc_by_file; cbsbf = cbsbf; &><%else>[ <% BlockCacheUtil.toJSON(bc) %>, <% BlockCacheUtil.toJSON(cbsbf) %> ] -<%java> -cbsbf = null; - - -<%def bc_by_file> -<%args> - CachedBlocksByFile cbsbf; - -<%java> - boolean firstEntry = true; - -[<%for Map.Entry> e: cbsbf.getCachedBlockStatsByFile().entrySet() %> - <%if !firstEntry %>,<% BlockCacheUtil.toJSON(e.getKey(), e.getValue()) %> - <%java> - if (firstEntry) { - firstEntry = false; - } - -] - diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon deleted file mode 100644 index 15426675deca..000000000000 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon +++ /dev/null @@ -1,330 +0,0 @@ -<%doc> - -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. - -<%args> -HRegionServer regionServer; -String filter = "general"; -String format = "html"; -String bcn = ""; -String bcv = ""; - -<%import> -java.util.*; -org.apache.hadoop.hbase.regionserver.HRegionServer; -org.apache.hadoop.hbase.client.RegionInfo; -org.apache.hadoop.hbase.ServerName; -org.apache.hadoop.hbase.HBaseConfiguration; -org.apache.hadoop.hbase.io.hfile.CacheConfig; -org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; -org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ServerInfo; -org.apache.hadoop.hbase.util.JvmVersion; -org.apache.hadoop.hbase.zookeeper.MasterAddressTracker; - -<%doc>If json AND bcn is NOT an empty string presume it a block cache view request. -<%if format.equals("json") && bcn != null && bcn.length() > 0 %> - <& BlockCacheViewTmpl; conf = regionServer.getConfiguration(); cacheConfig = new CacheConfig(regionServer.getConfiguration()); bcn = bcn; bcv = bcv; blockCache = regionServer.getBlockCache().orElse(null) &> - <%java return; %> -<%elseif format.equals("json") %> - <& ../common/TaskMonitorTmpl; filter = filter; format = "json" &> - <%java return; %> - -<%java> - ServerInfo serverInfo = ProtobufUtil.getServerInfo(null, regionServer.getRSRpcServices()); - ServerName serverName = ProtobufUtil.toServerName(serverInfo.getServerName()); - List onlineRegions = ProtobufUtil.getOnlineRegions(regionServer.getRSRpcServices()); - MasterAddressTracker masterAddressTracker = regionServer.getMasterAddressTracker(); - ServerName masterServerName = masterAddressTracker == null ? null - : masterAddressTracker.getMasterAddress(); - int infoPort = masterAddressTracker == null ? 0 : masterAddressTracker.getMasterInfoPort(); - - -<%class> - public String formatZKString() { - StringBuilder quorums = new StringBuilder(); - String zkQuorum = regionServer.getZooKeeper().getQuorum(); - - if (null == zkQuorum) { - return quorums.toString(); - } - - String[] zks = zkQuorum.split(","); - - if (zks.length == 0) { - return quorums.toString(); - } - - for(int i = 0; i < zks.length; ++i) { - quorums.append(zks[i].trim()); - - if (i != (zks.length - 1)) { - quorums.append("
"); - } - } - - return quorums.toString(); - } - - - - - - - - HBase Region Server: <% serverName.getHostname() %> - - - - - - - - - - - - -
-
- -
-
- -
-

Server Metrics

- <& ServerMetricsTmpl; mWrap = regionServer.getMetrics().getRegionServerWrapper(); - mServerWrap = regionServer.getRpcServer().getMetrics().getHBaseServerWrapper(); - bbAllocator = regionServer.getRpcServer().getByteBuffAllocator(); &> -
- -
-

Block Cache

- <& BlockCacheTmpl; cacheConfig = new CacheConfig(regionServer.getConfiguration()); config = regionServer.getConfiguration(); bc = regionServer.getBlockCache().orElse(null) &> -
- -
- <& ../common/TaskMonitorTmpl; filter = filter; parent = "/rs-status" &> -
- -
-

Regions

- <& RegionListTmpl; regionServer = regionServer; onlineRegions = onlineRegions; &> -
- -
-

Replication Status

- <& ReplicationStatusTmpl; regionServer = regionServer; &> -
- -
-

Software Attributes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <%escape #n> - - - - - - - - - - - - - - - - - - -
Attribute NameValueDescription
JVM Version<% JvmVersion.getVersion() %>JVM vendor and version
HBase Version<% org.apache.hadoop.hbase.util.VersionInfo.getVersion() %>, revision=<% org.apache.hadoop.hbase.util.VersionInfo.getRevision() %>HBase version and revision
HBase Compiled<% org.apache.hadoop.hbase.util.VersionInfo.getDate() %>, <% org.apache.hadoop.hbase.util.VersionInfo.getUser() %>When HBase version was compiled and by whom
HBase Source Checksum<% org.apache.hadoop.hbase.util.VersionInfo.getSrcChecksum() %>HBase source SHA512 checksum
Hadoop Version<% org.apache.hadoop.util.VersionInfo.getVersion() %>, revision=<% org.apache.hadoop.util.VersionInfo.getRevision() %>Hadoop version and revision
Hadoop Compiled<% org.apache.hadoop.util.VersionInfo.getDate() %>, <% org.apache.hadoop.util.VersionInfo.getUser() %>When Hadoop version was compiled and by whom
Hadoop Source Checksum<% org.apache.hadoop.util.VersionInfo.getSrcChecksum() %>Hadoop source MD5 checksum
ZooKeeper Client Version<% org.apache.zookeeper.Version.getVersion() %>, revision=<% org.apache.zookeeper.Version.getRevisionHash() %>ZooKeeper client version and revision hash
ZooKeeper Client Compiled<% org.apache.zookeeper.Version.getBuildDate() %>When ZooKeeper client version was compiled
ZooKeeper Quorum<% formatZKString() %>Addresses of all registered ZK servers
Coprocessors<% java.util.Arrays.toString(regionServer.getRegionServerCoprocessors()) %>Coprocessors currently loaded by this regionserver
RS Start Time<% new Date(regionServer.getStartcode()) %>Date stamp of when this region server was started
HBase Master - <%if masterServerName == null %> - No master found - <%else> - <%java> - String host = masterServerName.getHostname() + ":" + infoPort; - String url = "//" + host + "/master.jsp"; - - <% host %> - - Address of HBase Master
-
-
-
- - - - - - - diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon deleted file mode 100644 index c4b947308bad..000000000000 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon +++ /dev/null @@ -1,338 +0,0 @@ -<%doc> - - 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. - -<%args> - HRegionServer regionServer; - List onlineRegions; - -<%import> - java.util.*; - org.apache.commons.lang3.time.FastDateFormat; - org.apache.hadoop.hbase.regionserver.HRegionServer; - org.apache.hadoop.hbase.util.Bytes; - org.apache.hadoop.hbase.client.RegionInfo; - org.apache.hadoop.hbase.client.RegionInfoDisplay; - org.apache.hadoop.hbase.regionserver.Region; - org.apache.hadoop.hbase.regionserver.HStoreFile; - org.apache.hadoop.hbase.regionserver.Store; - org.apache.hadoop.hbase.regionserver.StoreFile; - org.apache.hadoop.hbase.ServerName; - org.apache.hadoop.hbase.HBaseConfiguration; - org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; - org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ServerInfo; - org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.RegionLoad; - org.apache.hadoop.hbase.client.RegionReplicaUtil; - org.apache.hadoop.hbase.regionserver.MetricsRegionWrapper; - org.apache.hadoop.util.StringUtils; - org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix; - -<%if (onlineRegions != null && onlineRegions.size() > 0) %> - - <%java> - Collections.sort(onlineRegions, RegionInfo.COMPARATOR); - - -
- -
-
- <& baseInfo; onlineRegions = onlineRegions; &> -
-
- <& requestStats; onlineRegions = onlineRegions; &> -
-
- <& storeStats; onlineRegions = onlineRegions; &> -
-
- <& memstoreStats; onlineRegions = onlineRegions; &> -
-
- <& compactStats; onlineRegions = onlineRegions; &> -
-
-
-

Region names are made of the containing table's name, a comma, - the start key, a comma, and a randomly generated region id. To illustrate, - the region named - domains,apache.org,5464829424211263407 is party to the table - domains, has an id of 5464829424211263407 and the first key - in the region is apache.org. The hbase:meta 'table' is an internal - system table (or a 'catalog' table in db-speak). - The hbase:meta table keeps a list of all regions in the system. The empty key is used to denote - table start and table end. A region with an empty start key is the first region in a table. - If a region has both an empty start key and an empty end key, it's the only region in the - table. See HBase Home for further explication.

-<%else> -

Not serving regions

- - -<%def baseInfo> -<%args> - List onlineRegions; - - - - - - - - - - - - - <%for RegionInfo r: onlineRegions %> - - <%java> - String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, - regionServer.getConfiguration()); - - - - - - - - -
Region NameStart KeyEnd KeyReplicaID
<% displayName %><% Bytes.toStringBinary(RegionInfoDisplay.getStartKeyForDisplay(r, - regionServer.getConfiguration())) %><% Bytes.toStringBinary(RegionInfoDisplay.getEndKeyForDisplay(r, - regionServer.getConfiguration())) %><% r.getReplicaId() %>
- - -<%def requestStats> -<%args> - List onlineRegions; - - - - - - - - - - - - - <%for RegionInfo r: onlineRegions %> - - - <%java> - RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); - String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, - regionServer.getConfiguration()); - - - <%if load != null %> - - - - - - - -
Region NameRead Request CountFiltered Read Request CountWrite Request Count
<% displayName %><% String.format("%,1d", load.getReadRequestsCount()) %><% String.format("%,1d", load.getFilteredReadRequestsCount()) %><% String.format("%,1d", load.getWriteRequestsCount()) %>
- - - -<%def storeStats> -<%args> - List onlineRegions; - - - - - - - - - - - - - - - - - - - <%for RegionInfo r: onlineRegions %> - - - <%java> - final String ZEROMB = "0 MB"; - final String ZEROKB = "0 KB"; - String uncompressedStorefileSizeStr = ZEROMB; - String storefileSizeStr = ZEROMB; - String indexSizeStr = ZEROKB; - String bloomSizeStr = ZEROKB; - RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); - String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, - regionServer.getConfiguration()); - if (load != null) { - long uncompressedStorefileSize = load.getStoreUncompressedSizeMB(); - long storefileSize = load.getStorefileSizeMB(); - long indexSize = load.getTotalStaticIndexSizeKB(); - long bloomSize = load.getTotalStaticBloomSizeKB(); - if (uncompressedStorefileSize > 0) { - uncompressedStorefileSizeStr = TraditionalBinaryPrefix.long2String( - uncompressedStorefileSize * TraditionalBinaryPrefix.MEGA.value, "B", 1); - } - if (storefileSize > 0) { - storefileSizeStr = TraditionalBinaryPrefix.long2String(storefileSize - * TraditionalBinaryPrefix.MEGA.value, "B", 1); - } - if(indexSize > 0) { - indexSizeStr = TraditionalBinaryPrefix.long2String(indexSize - * TraditionalBinaryPrefix.KILO.value, "B", 1); - } - if (bloomSize > 0) { - bloomSizeStr = TraditionalBinaryPrefix.long2String(bloomSize - * TraditionalBinaryPrefix.KILO.value, "B", 1); - } - } - long lenOfBiggestCellInRegion = -1L; - Region region = regionServer.getRegion(r.getEncodedName()); - if (region != null) { - List stores = region.getStores(); - for (Store store : stores) { - Collection storeFiles = store.getStorefiles(); - for (StoreFile sf : storeFiles) { - long lenOfBiggestCell = ((HStoreFile)sf).getFileInfo().getHFileInfo().getLenOfBiggestCell(); - if (lenOfBiggestCellInRegion < lenOfBiggestCell) { - lenOfBiggestCellInRegion = lenOfBiggestCell; - } - } - } - } - - - - <%if load != null %> - - - - - - - - - - - - - -
Region NameNum. StoresNum. StorefilesStorefile Size UncompressedStorefile SizeIndex SizeBloom SizeData LocalityLen Of Biggest Cell% Cached
<% displayName %><% String.format("%,1d", load.getStores()) %><% String.format("%,1d", load.getStorefiles()) %><% uncompressedStorefileSizeStr %><% storefileSizeStr %><% indexSizeStr %><% bloomSizeStr %><% load.getDataLocality() %><% String.format("%,1d", lenOfBiggestCellInRegion) %><% StringUtils.formatPercent(load.getCurrentRegionCachedRatio(), 2) %>
- - - -<%def compactStats> -<%args> - List onlineRegions; - - - - - - - - - - - - - - <%for RegionInfo r: onlineRegions %> - - - <%java> - RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); - String percentDone = ""; - String compactTime = ""; - if (load != null) { - if (load.getTotalCompactingKVs() > 0) { - percentDone = String.format("%.2f", 100 * - ((float) load.getCurrentCompactedKVs() / load.getTotalCompactingKVs())) + "%"; - } - if (load.getLastMajorCompactionTs() > 0) { - FastDateFormat fdf = FastDateFormat.getInstance("yyyy-MM-dd HH:mm (ZZ)"); - compactTime = fdf.format(load.getLastMajorCompactionTs()); - } - } - String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, - regionServer.getConfiguration()); - - - <%if load != null %> - - - - - - - - -
Region NameNum. Compacting CellsNum. Compacted CellsCompaction ProgressLast Major Compaction
<% displayName %><% String.format("%,1d", load.getTotalCompactingKVs()) %><% String.format("%,1d", load.getCurrentCompactedKVs()) %><% percentDone %><% compactTime %>
- - -<%def memstoreStats> -<%args> - List onlineRegions; - - - - - - - - - - - <%for RegionInfo r: onlineRegions %> - - - <%java> - final String ZEROMB = "0 MB"; - String memStoreSizeMBStr = ZEROMB; - RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); - String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, - regionServer.getConfiguration()); - if (load != null) { - long memStoreSizeMB = load.getMemStoreSizeMB(); - if (memStoreSizeMB > 0) { - memStoreSizeMBStr = TraditionalBinaryPrefix.long2String( - memStoreSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); - } - } - - - <%if load != null %> - - - - - -
Region NameMemstore Size
<% displayName %><% memStoreSizeMBStr %>
- diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ReplicationStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ReplicationStatusTmpl.jamon deleted file mode 100644 index 273b26aecd36..000000000000 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ReplicationStatusTmpl.jamon +++ /dev/null @@ -1,105 +0,0 @@ -<%doc> - - 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. - -<%args> - HRegionServer regionServer; - -<%import> - java.util.*; - java.util.Map.Entry; - org.apache.hadoop.hbase.procedure2.util.StringUtils; - org.apache.hadoop.hbase.regionserver.HRegionServer; - org.apache.hadoop.hbase.replication.regionserver.ReplicationStatus; - - -<%java> - Map walGroupsReplicationStatus = regionServer.getWalGroupsReplicationStatus(); - - -<%if (walGroupsReplicationStatus != null && walGroupsReplicationStatus.size() > 0) %> - -
- -
-
- <& currentLog; metrics = walGroupsReplicationStatus; &> -
-
- <& replicationDelay; metrics = walGroupsReplicationStatus; &> -
-
-
-

If the replication delay is UNKNOWN, that means this walGroup doesn't start replicate yet and it may get disabled. - If the size of log is 0, it means we are replicating current HLog, thus we can't get accurate size since it's not closed yet.

- -<%else> -

No Replication Metrics for Peers

- - -<%def currentLog> -<%args> - Map metrics; - - - - - - - - - - - <%for Map.Entry entry: metrics.entrySet() %> - - - - - - - - - -
PeerIdWalGroupCurrent LogSizeQueue SizeOffset
<% entry.getValue().getPeerId() %><% entry.getValue().getWalGroup() %><% entry.getValue().getCurrentPath() %> <% StringUtils.humanSize(entry.getValue().getFileSize()) %><% entry.getValue().getQueueSize() %><% StringUtils.humanSize(entry.getValue().getCurrentPosition()) %>
- - -<%def replicationDelay> -<%args> - Map metrics; - - - - - - - - - - <%for Map.Entry entry: metrics.entrySet() %> - - - - - - - - -
PeerIdWalGroupCurrent LogLast Shipped AgeReplication Delay
<% entry.getValue().getPeerId() %><% entry.getValue().getWalGroup() %><% entry.getValue().getCurrentPath() %> <% StringUtils.humanTimeDiff(entry.getValue().getAgeOfLastShippedOp()) %><% entry.getValue().getReplicationDelay() == Long.MAX_VALUE ? "UNKNOWN" : StringUtils.humanTimeDiff(entry.getValue().getReplicationDelay()) %>
- 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 deleted file mode 100644 index 7805a8b09087..000000000000 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon +++ /dev/null @@ -1,265 +0,0 @@ -<%doc> - -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. - -<%args> -MetricsRegionServerWrapper mWrap; -MetricsHBaseServerWrapper mServerWrap; -ByteBuffAllocator bbAllocator; - -<%import> -java.util.*; -org.apache.hadoop.hbase.regionserver.HRegionServer; -org.apache.hadoop.hbase.io.ByteBuffAllocator; -org.apache.hadoop.hbase.ipc.MetricsHBaseServerWrapper; -org.apache.hadoop.hbase.regionserver.MetricsRegionServerWrapper; -org.apache.hadoop.hbase.util.Bytes; -org.apache.hadoop.hbase.ServerName; -org.apache.hadoop.hbase.HBaseConfiguration; -org.apache.hadoop.hbase.util.DirectMemoryUtils; -org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix; -java.lang.management.MemoryUsage; -org.apache.hadoop.hbase.io.util.MemorySizeUtil; - -
- -
-
- <& baseStats; mWrap = mWrap &> -
-
- <& memoryStats; mWrap = mWrap &> -
-
- <& requestStats; mWrap = mWrap &> -
-
- <& walStats; mWrap = mWrap &> -
-
- <& storeStats; mWrap = mWrap &> -
-
- <& queueStats; mWrap = mWrap; mServerWrap = mServerWrap; &> -
-
- <& byteBuffAllocatorStats; bbAllocator = bbAllocator; &> -
-
-
- -<%def baseStats> -<%args> - MetricsRegionServerWrapper mWrap; - - - - - - - - - - - - - - - - - -
Requests Per SecondNum. RegionsBlock localityBlock locality (Secondary replicas)Slow WAL Append Count
<% String.format("%.0f", mWrap.getRequestsPerSecond()) %><% mWrap.getNumOnlineRegions() %><% String.format("%.3f",mWrap.getPercentFileLocal()) %><% "%" %><% String.format("%.3f",mWrap.getPercentFileLocalSecondaryRegions()) %><% "%" %><% mWrap.getNumWALSlowAppend() %>
- - -<%def memoryStats> -<%args> -MetricsRegionServerWrapper mWrap; - -<%java - long usedHeap = -1L; - long maxHeap = -1L; - final MemoryUsage usage = MemorySizeUtil.safeGetHeapMemoryUsage(); - if (usage != null) { - maxHeap = usage.getMax(); - usedHeap = usage.getUsed(); - } -%> - - - - - - - - - - - - - - - - - - - - - -
Used HeapMax HeapDirect Memory UsedDirect Memory ConfiguredMemstore On-Heap Size / LimitMemstore Off-Heap Size / LimitMemstore Data Size (On&&Off Heap)
- <% TraditionalBinaryPrefix.long2String(usedHeap, "B", 1) %> - - <% TraditionalBinaryPrefix.long2String(maxHeap, "B", 1) %> - - <% TraditionalBinaryPrefix.long2String(DirectMemoryUtils.getDirectMemoryUsage(), "B", 1) %> - - <% TraditionalBinaryPrefix.long2String(DirectMemoryUtils.getDirectMemorySize(), "B", 1) %> - - <% TraditionalBinaryPrefix.long2String(mWrap.getOnHeapMemStoreSize(), "B", 1) + " / " - + TraditionalBinaryPrefix.long2String(mWrap.getOnHeapMemStoreLimit(), "B", 1) %> - - <% TraditionalBinaryPrefix.long2String(mWrap.getOffHeapMemStoreSize(), "B", 1) + " / " - + TraditionalBinaryPrefix.long2String(mWrap.getOffHeapMemStoreLimit(), "B", 1) %> - - <% TraditionalBinaryPrefix.long2String(mWrap.getMemStoreSize(), "B", 1) %> -
- - -<%def walStats> -<%args> -MetricsRegionServerWrapper mWrap; - - - - - - - - - - - - - - -
Num. WAL FilesSize. WAL FilesWAL exclude DNs
<% mWrap.getNumWALFiles() %><% TraditionalBinaryPrefix.long2String(mWrap.getWALFileSize(), "B", 1) %> - <%for String exclude: mWrap.getWALExcludeDNs() %> - <% exclude %>
- -
- - -<%def storeStats> -<%args> -MetricsRegionServerWrapper mWrap; - - - - - - - - - - - - - - - - - -
Num. StoresNum. StorefilesRoot Index SizeIndex SizeBloom Size
<% mWrap.getNumStores() %><% mWrap.getNumStoreFiles() %><% TraditionalBinaryPrefix.long2String(mWrap.getStoreFileIndexSize(), "B", 1) %><% TraditionalBinaryPrefix.long2String(mWrap.getTotalStaticIndexSize(), "B", 1) %><% TraditionalBinaryPrefix.long2String(mWrap.getTotalStaticBloomSize(), "B", 1) %>
- - - -<%def requestStats> -<%args> -MetricsRegionServerWrapper mWrap; - - - - - - - - - - - - - - -
Request Per SecondRead Request CountFiltered Read Request CountWrite Request Count
<% String.format("%.0f", mWrap.getRequestsPerSecond()) %><% mWrap.getReadRequestsCount() %><% mWrap.getFilteredReadRequestsCount() %><% mWrap.getWriteRequestsCount() %>
- - -<%def queueStats> -<%args> -MetricsRegionServerWrapper mWrap; -MetricsHBaseServerWrapper mServerWrap; - - - - - - - - - - - - - - - - - - - -
Compaction Queue LengthFlush Queue LengthPriority Call Queue LengthGeneral Call Queue LengthReplication Call Queue LengthTotal Call Queue Size
<% mWrap.getCompactionQueueSize() %><% mWrap.getFlushQueueSize() %><% mServerWrap.getPriorityQueueLength() %><% mServerWrap.getGeneralQueueLength() %><% mServerWrap.getReplicationQueueLength() %><% TraditionalBinaryPrefix.long2String(mServerWrap.getTotalQueueSize(), "B", 1) %>
- - -<%def byteBuffAllocatorStats> -<%args> -ByteBuffAllocator bbAllocator; - - - - - - - - - - - - - - - - - - -
Total Heap AllocationTotal Pool AllocationHeap Allocation RatioTotal Buffer CountUsed Buffer CountBuffer Size
<% TraditionalBinaryPrefix.long2String(ByteBuffAllocator.getHeapAllocationBytes(bbAllocator, ByteBuffAllocator.HEAP), "B", 1) %><% TraditionalBinaryPrefix.long2String(bbAllocator.getPoolAllocationBytes(), "B", 1) %><% String.format("%.3f", ByteBuffAllocator.getHeapAllocationRatio(bbAllocator, ByteBuffAllocator.HEAP) * 100) %><% "%" %><% bbAllocator.getTotalBufferCount() %><% bbAllocator.getUsedBufferCount() %><% TraditionalBinaryPrefix.long2String(bbAllocator.getBufferSize(), "B", 1) %>
- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/http/MasterStatusUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/http/MasterStatusUtil.java index 221e43f8e114..c860e89681c9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/http/MasterStatusUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/http/MasterStatusUtil.java @@ -79,7 +79,7 @@ public static ServerName getMetaLocationOrNull(HMaster master) { public static String serverNameLink(HMaster master, ServerName serverName) { int infoPort = master.getRegionServerInfoPort(serverName); - String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; + String url = "//" + serverName.getHostname() + ":" + infoPort + "/regionserver.jsp"; if (infoPort > 0) { return "" + serverName.getServerName() + ""; } else { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/http/RSStatusConstants.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/http/RSStatusConstants.java new file mode 100644 index 000000000000..09b7c34e3318 --- /dev/null +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/http/RSStatusConstants.java @@ -0,0 +1,41 @@ +/* + * 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.hadoop.hbase.regionserver.http; + +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Constants used by the web UI JSP pages. + */ +@InterfaceAudience.Private +public final class RSStatusConstants { + public static final String FILTER = "filter"; + public static final String FILTER_GENERAL = "general"; + public static final String FORMAT = "format"; + public static final String FORMAT_JSON = "json"; + public static final String FORMAT_HTML = "html"; + public static final String PARENT = "parent"; + public static final String BLOCK_CACHE_NAME = "bcn"; + public static final String BLOCK_CACHE_NAME_L1 = "L1"; + public static final String BLOCK_CACHE_V = "bcv"; + public static final String BLOCK_CACHE_V_FILE = "file"; + + private RSStatusConstants() { + // Do not instantiate. + } +} diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/http/RSStatusServlet.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/http/RSStatusServlet.java index 43bac8791b48..9b8f9833f0b8 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/http/RSStatusServlet.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/http/RSStatusServlet.java @@ -18,43 +18,20 @@ package org.apache.hadoop.hbase.regionserver.http; import java.io.IOException; -import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.hadoop.hbase.regionserver.HRegionServer; -import org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl; import org.apache.yetus.audience.InterfaceAudience; +/** + * Only kept for redirecting to regionserver.jsp. + */ @InterfaceAudience.Private public class RSStatusServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { - HRegionServer hrs = - (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); - assert hrs != null : "No RS in context!"; - - String format = req.getParameter("format"); - if ("json".equals(format)) { - resp.setContentType("application/json"); - } else { - resp.setContentType("text/html"); - } - - if (!hrs.isOnline()) { - resp.getWriter().write("The RegionServer is initializing!"); - resp.getWriter().close(); - return; - } - - RSStatusTmpl tmpl = new RSStatusTmpl(); - if (format != null) tmpl.setFormat(format); - if (req.getParameter("filter") != null) tmpl.setFilter(req.getParameter("filter")); - if (req.getParameter("bcn") != null) tmpl.setBcn(req.getParameter("bcn")); - if (req.getParameter("bcv") != null) tmpl.setBcv(req.getParameter("bcv")); - tmpl.render(resp.getWriter(), hrs); + public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + response.sendRedirect(request.getContextPath() + "/regionserver.jsp"); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKStringFormatter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKStringFormatter.java new file mode 100644 index 000000000000..a83f07014b05 --- /dev/null +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKStringFormatter.java @@ -0,0 +1,57 @@ +/* + * 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.hadoop.hbase.util; + +import org.apache.hadoop.hbase.zookeeper.ZKWatcher; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Utility used by both Master and Region Server web UI JSP pages. + */ +@InterfaceAudience.Private +public final class ZKStringFormatter { + + private ZKStringFormatter() { + // Do not instantiate. + } + + public static String formatZKString(ZKWatcher zookeeper) { + StringBuilder quorums = new StringBuilder(); + String zkQuorum = zookeeper.getQuorum(); + + if (null == zkQuorum) { + return quorums.toString(); + } + + String[] zks = zkQuorum.split(","); + + if (zks.length == 0) { + return quorums.toString(); + } + + for (int i = 0; i < zks.length; ++i) { + quorums.append(zks[i].trim()); + + if (i != (zks.length - 1)) { + quorums.append("
"); + } + } + + return quorums.toString(); + } +} diff --git a/hbase-server/src/main/resources/hbase-webapps/master/taskMonitor.jsp b/hbase-server/src/main/resources/hbase-webapps/common/taskMonitor.jsp similarity index 100% rename from hbase-server/src/main/resources/hbase-webapps/master/taskMonitor.jsp rename to hbase-server/src/main/resources/hbase-webapps/common/taskMonitor.jsp diff --git a/hbase-server/src/main/resources/hbase-webapps/master/taskMonitorRenderTasks.jsp b/hbase-server/src/main/resources/hbase-webapps/common/taskMonitorRenderTasks.jsp similarity index 100% rename from hbase-server/src/main/resources/hbase-webapps/master/taskMonitorRenderTasks.jsp rename to hbase-server/src/main/resources/hbase-webapps/common/taskMonitorRenderTasks.jsp diff --git a/hbase-server/src/main/resources/hbase-webapps/master/hbck.jsp b/hbase-server/src/main/resources/hbase-webapps/master/hbck.jsp index a6c6c2d17e66..210438ba7fed 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/hbck.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/hbck.jsp @@ -383,7 +383,7 @@ private static String formatServerName(HMaster master, int infoPort = master.getRegionServerInfoPort(serverName); if (infoPort > 0) { return "" + sn + ""; + infoPort + "/regionserver.jsp>" + sn + ""; } else { return "" + sn + ""; } diff --git a/hbase-server/src/main/resources/hbase-webapps/master/master.jsp b/hbase-server/src/main/resources/hbase-webapps/master/master.jsp index 7e5371238513..76dbd656e9de 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/master.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/master.jsp @@ -32,6 +32,7 @@ if (format != null && format.equals("json")) { request.setAttribute(MasterStatusConstants.FILTER, filter); request.setAttribute(MasterStatusConstants.FORMAT, "json"); + response.setContentType("application/json"); %> <% @@ -143,6 +144,7 @@ <% } %>
+ <% request.setAttribute(MasterStatusConstants.PARENT, "/master.jsp"); %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp b/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp index c86c9902ea1b..91734e8d0a3d 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp @@ -38,10 +38,11 @@ import="org.apache.hadoop.hbase.rsgroup.RSGroupUtil" import="org.apache.hadoop.hbase.util.Bytes" import="org.apache.hadoop.hbase.util.VersionInfo" - import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix"%> -<%@ page import="org.apache.hadoop.hbase.ServerMetrics" %> -<%@ page import="org.apache.hadoop.hbase.Size" %> -<%@ page import="org.apache.hadoop.hbase.RegionMetrics" %> + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" + import="org.apache.hadoop.hbase.ServerMetrics" + import="org.apache.hadoop.hbase.Size" + import="org.apache.hadoop.hbase.RegionMetrics" + import="static org.apache.hadoop.hbase.master.http.MasterStatusUtil.serverNameLink" %> <% String rsGroupName = request.getParameter("name"); pageContext.setAttribute("pageTitle", "RSGroup: " + rsGroupName); @@ -167,11 +168,9 @@ totalRequestsPerSecond += sl.getRequestCountPerSecond(); lastContact = (System.currentTimeMillis() - sl.getReportTimestamp())/1000; } - long startcode = serverName.getStartCode(); - int infoPort = master.getRegionServerInfoPort(serverName); - String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status";%> + long startcode = serverName.getStartCode(); %> - <%= serverName.getServerName() %> + <%= serverNameLink(master, serverName) %> <%= new Date(startcode) %> <%= lastContact %> <%= version %> @@ -223,8 +222,6 @@ double memStoreSizeMB = sl.getRegionMetrics().values() .stream().mapToDouble(rm -> rm.getMemStoreSize().get(Size.Unit.MEGABYTE)) .sum(); - int infoPort = master.getRegionServerInfoPort(serverName); - String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; if (memStoreSizeMB > 0) { memStoreSizeMBStr = TraditionalBinaryPrefix.long2String( @@ -240,7 +237,7 @@ } %> - <%= serverName.getServerName() %> + <%= serverNameLink(master, serverName) %> <%= usedHeapSizeMBStr %> <%= maxHeapSizeMBStr %> <%= memStoreSizeMBStr %> @@ -268,17 +265,15 @@ ServerName serverName = serverMaping.get(server); ServerMetrics sl = onlineServers.get(server); if (sl != null && serverName != null) { - int infoPort = master.getRegionServerInfoPort(serverName); long readRequestCount = 0; long writeRequestCount = 0; for (RegionMetrics rm : sl.getRegionMetrics().values()) { readRequestCount += rm.getReadRequestCount(); writeRequestCount += rm.getWriteRequestCount(); } - String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; %> - <%= serverName.getServerName() %> + <%= serverNameLink(master, serverName) %> <%= sl.getRequestCountPerSecond() %> <%= readRequestCount %> <%= writeRequestCount %> @@ -328,8 +323,6 @@ totalStaticIndexSizeKB += rm.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE); totalStaticBloomSizeKB += rm.getBloomFilterSize().get(Size.Unit.KILOBYTE); } - int infoPort = master.getRegionServerInfoPort(serverName); - String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; if (storeUncompressedSizeMB > 0) { storeUncompressedSizeMBStr = TraditionalBinaryPrefix.long2String( (long) storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); @@ -348,7 +341,7 @@ } %> - <%= serverName.getServerName() %> + <%= serverNameLink(master, serverName) %> <%= storeCount %> <%= storeFileCount %> <%= storeUncompressedSizeMBStr %> @@ -394,11 +387,9 @@ percentDone = String.format("%.2f", 100 * ((float) currentCompactedCells / totalCompactingCells)) + "%"; } - int infoPort = master.getRegionServerInfoPort(serverName); - String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; %> - <%= serverName.getServerName() %> + <%= serverNameLink(master, serverName) %> <%= totalCompactingCells %> <%= currentCompactedCells %> <%= totalCompactingCells - currentCompactedCells %> diff --git a/hbase-server/src/main/resources/hbase-webapps/master/softwareAttributes.jsp b/hbase-server/src/main/resources/hbase-webapps/master/softwareAttributes.jsp index 725a116790c9..3feb1e1323f3 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/softwareAttributes.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/softwareAttributes.jsp @@ -23,34 +23,8 @@ import="org.apache.hadoop.hbase.util.JvmVersion" import="org.apache.hadoop.hbase.util.CommonFSUtils" import="org.apache.hadoop.util.StringUtils" - import="org.apache.hadoop.hbase.master.http.MasterStatusConstants" %> - -<%! - public static String formatZKString(HMaster master) { - StringBuilder quorums = new StringBuilder(); - String zkQuorum = master.getZooKeeper().getQuorum(); - - if (null == zkQuorum) { - return quorums.toString(); - } - - String[] zks = zkQuorum.split(","); - - if (zks.length == 0) { - return quorums.toString(); - } - - for(int i = 0; i < zks.length; ++i) { - quorums.append(zks[i].trim()); - - if (i != (zks.length - 1)) { - quorums.append("
"); - } - } - - return quorums.toString(); - } -%> + import="org.apache.hadoop.hbase.master.http.MasterStatusConstants" + import="org.apache.hadoop.hbase.util.ZKStringFormatter" %> <% HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER); @@ -111,7 +85,7 @@ ZooKeeper Quorum - <%= formatZKString(master) %> + <%= ZKStringFormatter.formatZKString(master.getZooKeeper()) %> Addresses of all registered ZK servers. For more, see zk dump. @@ -121,7 +95,7 @@ Cluster Key - <%= formatZKString(master) %>:<%= master.getZooKeeper().getZNodePaths().baseZNode %> + <%= ZKStringFormatter.formatZKString(master.getZooKeeper()) %>:<%= master.getZooKeeper().getZNodePaths().baseZNode %> Key to add this cluster as a peer for replication. Use 'help "add_peer"' in the shell for details. 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 f55d1dd81703..82cfd415cd04 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -124,7 +124,7 @@ String hostNameEncoded = URLEncoder.encode(hostName, StandardCharsets.UTF_8); // This port might be wrong if RS actually ended up using something else. int serverInfoPort = master.getRegionServerInfoPort(serverName); - String urlRegionServer = "//" + hostNameEncoded + ":" + serverInfoPort + "/rs-status"; + String urlRegionServer = "//" + hostNameEncoded + ":" + serverInfoPort + "/regionserver.jsp"; return "" + StringEscapeUtils.escapeHtml4(hostName) + ":" + serverInfoPort + ""; @@ -394,7 +394,7 @@ %> <%= escapeXml(meta.getRegionNameAsString()) %> - <%= StringEscapeUtils.escapeHtml4(hostAndPort) %> + <%= StringEscapeUtils.escapeHtml4(hostAndPort) %> <%= readReq%> <%= writeReq%> <%= fileSizeUncompressed%> @@ -451,7 +451,7 @@ %> <%= escapeXml(meta.getRegionNameAsString()) %> - <%= StringEscapeUtils.escapeHtml4(hostAndPort) %> + <%= StringEscapeUtils.escapeHtml4(hostAndPort) %> <%= locality%> <%= localityForSsd%> @@ -508,7 +508,7 @@ %> <%= escapeXml(meta.getRegionNameAsString()) %> - <%= StringEscapeUtils.escapeHtml4(hostAndPort) %> + <%= StringEscapeUtils.escapeHtml4(hostAndPort) %> <%= String.format("%,1d", compactingCells)%> <%= String.format("%,1d", compactedCells)%> <%= String.format("%,1d", compactingCells - compactedCells)%> @@ -1170,7 +1170,7 @@ for (Map.Entry rdEntry : regDistribution.entrySet()) { ServerName addr = rdEntry.getKey(); String url = "//" + URLEncoder.encode(addr.getHostname(), StandardCharsets.UTF_8) + ":" - + master.getRegionServerInfoPort(addr) + "/rs-status"; + + master.getRegionServerInfoPort(addr) + "/regionserver.jsp"; %> <%= StringEscapeUtils.escapeHtml4(addr.getHostname()) diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCache.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCache.jsp new file mode 100644 index 000000000000..7bba000a271a --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCache.jsp @@ -0,0 +1,72 @@ +<%-- +/** + * 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="org.apache.hadoop.hbase.io.hfile.BlockCache" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" %> +<%@ page import="org.apache.hadoop.hbase.io.hfile.CacheConfig" %> + +<%-- Template for rendering Block Cache tabs in RegionServer Status page. --%> + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + CacheConfig cacheConfig = new CacheConfig(regionServer.getConfiguration()); + + BlockCache bc = regionServer.getBlockCache().orElse(null); + + BlockCache[] bcs = bc == null ? null : bc.getBlockCaches(); + BlockCache l1 = bcs == null ? bc : bcs[0]; + BlockCache l2 = bcs == null ? null : bcs.length <= 1 ? null : bcs[1]; +%> + +
+ +
+
+ <% request.setAttribute("bc", bc); %> + +
+
+ <% request.setAttribute("cacheConfig", cacheConfig); %> + +
+
+ <% request.setAttribute("bc", bc); %> + +
+
+ <% request.setAttribute("bc", l1); %> + <% request.setAttribute("name", "L1"); %> + +
+
+ <% request.setAttribute("bc", l2); %> + <% request.setAttribute("name", "L2"); %> + +
+
+
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheBaseInfo.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheBaseInfo.jsp new file mode 100644 index 000000000000..d7d322d4754d --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheBaseInfo.jsp @@ -0,0 +1,42 @@ +<%-- +/** + * 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="org.apache.hadoop.hbase.io.hfile.BlockCache" %> + +<% + BlockCache bc = (BlockCache) request.getAttribute("bc"); + + String bcUrl = bc == null ? null : "http://hbase.apache.org/devapidocs/" + bc.getClass().getName().replaceAll("\\.", "/") + ".html"; + String bcName = bc == null ? null : bc.getClass().getSimpleName(); +%> + + + + + + + + + + + + +
AttributeValueDescription
Implementation<%= bcName %>Block cache implementing class
+

See block cache in the HBase Reference Guide for help.

diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheConfig.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheConfig.jsp new file mode 100644 index 000000000000..d73652de4cb2 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheConfig.jsp @@ -0,0 +1,72 @@ +<%-- +/** + * 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="org.apache.hadoop.hbase.io.hfile.CacheConfig" %> + +<% + CacheConfig cacheConfig = (CacheConfig) request.getAttribute("cacheConfig"); +if (cacheConfig == null) { %> +

CacheConfig is null

+<% } else { %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeValueDescription
Cache DATA on Read<%= cacheConfig.shouldCacheDataOnRead() %>True if DATA blocks are cached on read + (INDEX & BLOOM blocks are always cached)
Cache DATA on Write<%= cacheConfig.shouldCacheDataOnWrite() %>True if DATA blocks are cached on write.
Cache INDEX on Write<%= cacheConfig.shouldCacheIndexesOnWrite() %>True if INDEX blocks are cached on write
Cache BLOOM on Write<%= cacheConfig.shouldCacheBloomsOnWrite() %>True if BLOOM blocks are cached on write
Evict blocks on Close<%= cacheConfig.shouldEvictOnClose() %>True if blocks are evicted from cache when an HFile + reader is closed
Cache DATA in compressed format<%= cacheConfig.shouldCacheDataCompressed() %>True if DATA blocks are cached in their compressed form
Prefetch on Open<%= cacheConfig.shouldPrefetchOnOpen() %>True if blocks are prefetched into cache on open
+<% } %> diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheEvictions.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheEvictions.jsp new file mode 100644 index 000000000000..58870ca0072f --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheEvictions.jsp @@ -0,0 +1,45 @@ +<%-- +/** + * 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="org.apache.hadoop.hbase.io.hfile.BlockCache" + import="org.apache.hadoop.hbase.io.hfile.AgeSnapshot" %> + +<% + BlockCache bc = (BlockCache) request.getAttribute("bc"); + + AgeSnapshot ageAtEvictionSnapshot = bc.getStats().getAgeAtEvictionSnapshot(); + // Only show if non-zero mean and stddev as is the case in combinedblockcache +%> + + + Evicted + <%= String.format("%,d", bc.getStats().getEvictedCount()) %> + The total number of blocks evicted + + + Evictions + <%= String.format("%,d", bc.getStats().getEvictionCount()) %> + The total number of times an eviction has occurred + + + Mean + <%= String.format("%,d", (long)ageAtEvictionSnapshot.getMean()) %> + Mean age of Blocks at eviction time (seconds) + diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheHits.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheHits.jsp new file mode 100644 index 000000000000..df9da58592c2 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheHits.jsp @@ -0,0 +1,92 @@ +<%-- +/** + * 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="org.apache.hadoop.hbase.io.hfile.BlockCache" %> + +<% + BlockCache bc = (BlockCache) request.getAttribute("bc"); + + int hitPeriods = 0; + for (int i = 0; i < bc.getStats().getNumPeriodsInWindow(); i++) { + if (bc.getStats().getWindowPeriods()[i] != null) { + hitPeriods++; + } + } +%> + +<% if (hitPeriods > 0) { %> + +<% } %> + + Hits + <%= String.format("%,d", bc.getStats().getHitCount()) %> + Number requests that were cache hits + + + Hits Caching + <%= String.format("%,d", bc.getStats().getHitCachingCount()) %> + Cache hit block requests but only requests set to cache block if a miss + + + Misses + <%= String.format("%,d", bc.getStats().getMissCount()) %> + Block requests that were cache misses but set to cache missed blocks + + + Misses Caching + <%= String.format("%,d", bc.getStats().getMissCachingCount()) %> + Block requests that were cache misses but only requests set to use block cache + + + All Time Hit Ratio + <%= String.format("%,.2f", bc.getStats().getHitRatio() * 100) %><%= "%" %> + Hit Count divided by total requests count + +<% for (int i = 0; i < hitPeriods; i++) { %> +<%-- These rows are hidden on page load, blockCacheInit.js will display these as paginated. --%> + + Hit Ratio for period starting at <%= bc.getStats().getWindowPeriods()[i] %> + <% if (bc.getStats().getRequestCounts()[i] > 0) { %> + <%= String.format("%,.2f", ((double)bc.getStats().getHitCounts()[i] / (double)bc.getStats().getRequestCounts()[i]) * 100.0) %><%= "%" %> + <% } else { %> + No requests + <% } %> + Hit Count divided by total requests count over the <%= i %>th period of <%= bc.getStats().getPeriodTimeInMinutes() %> minutes + +<% } %> +<% if (hitPeriods > 0) { %> + + +
+ + + + +
+ + +<% } %> +<% if (bc.getStats().getPeriodTimeInMinutes() > 0) { %> + + Last <%= bc.getStats().getNumPeriodsInWindow()*bc.getStats().getPeriodTimeInMinutes() %> minutes Hit Ratio + <%= String.format("%,.2f", bc.getStats().getHitRatioPastNPeriods() * 100.0) %><%= "%" %> + Hit Count divided by total requests count for the last <%= bc.getStats().getNumPeriodsInWindow()*bc.getStats().getPeriodTimeInMinutes() %> minutes + +<% } %> diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheLevel.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheLevel.jsp new file mode 100644 index 000000000000..47cc6a5a9856 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheLevel.jsp @@ -0,0 +1,159 @@ +<%-- +/** + * 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="org.apache.hadoop.conf.Configuration" + import="org.apache.hadoop.hbase.io.hfile.BlockCache" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.io.hfile.BlockCacheUtil" + import="org.apache.hadoop.hbase.io.hfile.LruBlockCache" + import="org.apache.hadoop.hbase.io.hfile.bucket.BucketCacheStats" + import="org.apache.hadoop.hbase.io.hfile.bucket.BucketCache" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" %> + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + Configuration configuration = regionServer.getConfiguration(); + + BlockCache bc = (BlockCache) request.getAttribute("bc"); + + String name = (String) request.getAttribute("name"); +%> + +<% if (bc == null) { %> +

No <%= name %> deployed

+<% } else { %> + +<% + String bcUrl = "http://hbase.apache.org/devapidocs/" + bc.getClass().getName().replaceAll("\\.", "/") + ".html"; + String bcName = bc.getClass().getSimpleName(); + int maxCachedBlocksByFile = BlockCacheUtil.getMaxCachedBlocksByFile(configuration); + + boolean isLru = bc instanceof LruBlockCache; + + boolean isBucketCache = bc.getClass().getSimpleName().equals("BucketCache"); + BucketCacheStats bucketCacheStats = null; + BucketCache bucketCache = null; + if (bc instanceof BucketCache) { + bucketCache = (BucketCache) bc; + bucketCacheStats = (BucketCacheStats) bc.getStats(); + } +%> + + + + + + + + + + + + +<% if (isBucketCache) { %> + + + + + +<% } %> + + + + + + + + + + +<% if (!isBucketCache) { %> + + + + + +<% } %> +<% if (isLru) { %> + + + + + + + + + + +<% } %> + + + + + +<% if (!isBucketCache) { %> + + + + + +<% } %> +<% if (isLru) { %> + + + + + + + + + + +<% } %> + <% request.setAttribute("bc", bc); %> + + + +<% if (isBucketCache) { %> + + + + + + + + + + +<% } %> +
AttributeValueDescription
Implementation<%= bcName %>Class implementing this block cache Level
IOEngine<%= bucketCache.getIoEngine() %>Supported IOEngine types: offheap, file, files, mmap or pmem. See hbase.bucketcache.ioengine.
Cache Size Limit<%= TraditionalBinaryPrefix.long2String(bc.getMaxSize(), "B", 1) %>Max size of cache
Block Count<%= String.format("%,d", bc.getBlockCount()) %>Count of Blocks
Data Block Count<%= String.format("%,d", bc.getDataBlockCount()) %>Count of DATA Blocks
Index Block Count<%= String.format("%,d", ((LruBlockCache)bc).getIndexBlockCount()) %>Count of INDEX Blocks
Bloom Block Count<%= String.format("%,d", ((LruBlockCache)bc).getBloomBlockCount()) %>Count of BLOOM Blocks
Size of Blocks<%= TraditionalBinaryPrefix.long2String(bc.getCurrentSize(), "B", 1) %>Size of Blocks
Size of Data Blocks<%= TraditionalBinaryPrefix.long2String(bc.getCurrentDataSize(), "B", 1) %>Size of DATA Blocks
Size of Index Blocks<%= TraditionalBinaryPrefix.long2String(((LruBlockCache)bc).getCurrentIndexSize(), "B", 1) %>Size of INDEX Blocks
Size of Bloom Blocks<%= TraditionalBinaryPrefix.long2String(((LruBlockCache)bc).getCurrentBloomSize(), "B", 1) %>Size of BLOOM Blocks
Hits per Second<%= bucketCacheStats.getIOHitsPerSecond() %>Block gets against this cache per second
Time per Hit<%= bucketCacheStats.getIOTimePerHit() %>Time per cache hit
+ +<%-- Call through to block cache Detail rendering template --%> +

+ View block cache as JSON | Block cache as JSON by file + <% if (bc.getBlockCount() > maxCachedBlocksByFile) { %> +
+ Note: JSON view of block cache will be incomplete, because block count <%= bc.getBlockCount() %> is greater than hbase.ui.blockcache.by.file.max value of <%= maxCachedBlocksByFile %>. + Increase that value to get a complete picture. + <% } %> +

+<% } %> diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheStats.jsp new file mode 100644 index 000000000000..c30160b7621b --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheStats.jsp @@ -0,0 +1,58 @@ +<%-- +/** + * 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="org.apache.hadoop.hbase.io.hfile.BlockCache" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" %> + +<% + BlockCache bc = (BlockCache) request.getAttribute("bc"); +if (bc == null) { %> +

BlockCache is null

+<% } else { %> + + + + + + + + + + + + + + + + + + + + + + <% request.setAttribute("bc", bc); %> + + +
AttributeValueDescription
Size<%= TraditionalBinaryPrefix.long2String(bc.getCurrentSize(), + "B", 1) %>Current size of block cache in use
Free<%= TraditionalBinaryPrefix.long2String(bc.getFreeSize(), + "B", 1) %>The total free memory currently available to store more cache entries
Count<%= String.format("%,d", bc.getBlockCount()) %>Number of blocks in block cache
+

If block cache is made up of more than one cache -- i.e. a L1 and a L2 -- then the above + are combined counts. Request count is sum of hits and misses.

+<% } %> diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheView.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheView.jsp new file mode 100644 index 000000000000..be6061bc652a --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheView.jsp @@ -0,0 +1,62 @@ +<%-- +/** + * 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.*" + import="org.apache.hadoop.hbase.io.hfile.BlockCache" + import="org.apache.hadoop.conf.Configuration" + import="org.apache.hadoop.hbase.io.hfile.BlockCacheUtil" + import="org.apache.hadoop.hbase.io.hfile.CachedBlock" + import="org.apache.hadoop.hbase.regionserver.http.RSStatusConstants" %><% + // This template is used to give views on an individual block cache as JSON. + + Configuration conf = (Configuration) request.getAttribute("conf"); + String bcn = (String) request.getAttribute(RSStatusConstants.BLOCK_CACHE_NAME); + String bcv = (String) request.getAttribute(RSStatusConstants.BLOCK_CACHE_V); + BlockCache bc = (BlockCache) request.getAttribute("blockCache"); + + BlockCache [] bcs = bc == null ? null : bc.getBlockCaches(); + if (bcn.equals(RSStatusConstants.BLOCK_CACHE_NAME_L1)) { + bc = bcs == null || bcs.length == 0? bc: bcs[0]; + } else { + if (bcs == null || bcs.length < 2) { + System.out.println("There is no L2 block cache"); + return; + } + bc = bcs[1]; + } + if (bc == null) { + System.out.println("There is no block cache"); + return; + } + BlockCacheUtil.CachedBlocksByFile cbsbf = BlockCacheUtil.getLoadedCachedBlocksByFile(conf, bc); + if (bcv.equals(RSStatusConstants.BLOCK_CACHE_V_FILE)) { + boolean firstEntry = true; %> + [<% for (Map.Entry> e: cbsbf.getCachedBlockStatsByFile().entrySet()) { %> + <% if (!firstEntry) { %>,<% } %><%= BlockCacheUtil.toJSON(e.getKey(), e.getValue()) %> + <% + if (firstEntry) { + firstEntry = false; + } + %> + <% } %>] + +<% } else { %> +[ <%= BlockCacheUtil.toJSON(bc) %>, <%= BlockCacheUtil.toJSON(cbsbf) %> ] +<% } %> diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/footer.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/footer.jsp index 02a36e9c23fa..4b2d6cb2f5ee 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/footer.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/footer.jsp @@ -17,14 +17,6 @@ * limitations under the License. */ --%> - - - - + diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/header.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/header.jsp index 14d22363c513..47e46017b744 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/header.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/header.jsp @@ -37,7 +37,7 @@