blob: 1a73394a212560a79d85fff0fc40f50644b1d526 [file] [log] [blame]
<%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.
</%doc>
<%args>
HRegionServer regionServer;
List<RegionInfo> onlineRegions;
</%args>
<%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.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.TraditionalBinaryPrefix;
</%import>
<%if (onlineRegions != null && onlineRegions.size() > 0) %>
<%java>
Collections.sort(onlineRegions, RegionInfo.COMPARATOR);
</%java>
<div class="tabbable">
<ul class="nav nav-pills">
<li class="active"><a href="#tab_regionBaseInfo" data-toggle="tab">Base Info</a> </li>
<li><a href="#tab_regionRequestStats" data-toggle="tab">Request metrics</a></li>
<li class=""><a href="#tab_regionStoreStats" data-toggle="tab">Storefile Metrics</a></li>
<li class=""><a href="#tab_regionMemstoreStats" data-toggle="tab">Memstore Metrics</a></li>
<li class=""><a href="#tab_regionCompactStats" data-toggle="tab">Compaction Metrics</a></li>
</ul>
<div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;">
<div class="tab-pane active" id="tab_regionBaseInfo">
<& baseInfo; onlineRegions = onlineRegions; &>
</div>
<div class="tab-pane" id="tab_regionRequestStats">
<& requestStats; onlineRegions = onlineRegions; &>
</div>
<div class="tab-pane" id="tab_regionStoreStats">
<& storeStats; onlineRegions = onlineRegions; &>
</div>
<div class="tab-pane" id="tab_regionMemstoreStats">
<& memstoreStats; onlineRegions = onlineRegions; &>
</div>
<div class="tab-pane" id="tab_regionCompactStats">
<& compactStats; onlineRegions = onlineRegions; &>
</div>
</div>
</div>
<p>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
<em>domains,apache.org,5464829424211263407</em> is party to the table
<em>domains</em>, has an id of <em>5464829424211263407</em> and the first key
in the region is <em>apache.org</em>. The <em>hbase:meta</em> '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 <a href="http://hbase.apache.org">HBase Home</a> for further explication.<p>
<%else>
<p>Not serving regions</p>
</%if>
<%def baseInfo>
<%args>
List<RegionInfo> onlineRegions;
</%args>
<table id="baseStatsTable" class="tablesorter table table-striped">
<thead>
<tr>
<th>Region Name</th>
<th>Start Key</th>
<th>End Key</th>
<th>ReplicaID</th>
</tr>
</thead>
<tbody>
<%for RegionInfo r: onlineRegions %>
<tr>
<%java>
String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r,
regionServer.getConfiguration());
</%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<td><% Bytes.toStringBinary(RegionInfoDisplay.getStartKeyForDisplay(r,
regionServer.getConfiguration())) %></td>
<td><% Bytes.toStringBinary(RegionInfoDisplay.getEndKeyForDisplay(r,
regionServer.getConfiguration())) %></td>
<td><% r.getReplicaId() %></td>
</tr>
</%for>
</tbody>
</table>
</%def>
<%def requestStats>
<%args>
List<RegionInfo> onlineRegions;
</%args>
<table id="requestStatsTable" class="tablesorter table table-striped">
<thead>
<tr>
<th>Region Name</th>
<th>Read Request Count</th>
<th>Filtered Read Request Count</th>
<th>Write Request Count</th>
</tr>
</thead>
<tbody>
<%for RegionInfo r: onlineRegions %>
<tr>
<%java>
RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r,
regionServer.getConfiguration());
</%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<%if load != null %>
<td><% String.format("%,1d", load.getReadRequestsCount()) %></td>
<td><% String.format("%,1d", load.getFilteredReadRequestsCount()) %></td>
<td><% String.format("%,1d", load.getWriteRequestsCount()) %></td>
</%if>
</tr>
</%for>
</tbody>
</table>
</%def>
<%def storeStats>
<%args>
List<RegionInfo> onlineRegions;
</%args>
<table id="storeStatsTable" class="tablesorter table table-striped">
<thead>
<tr>
<th>Region Name</th>
<th>Num. Stores</th>
<th>Num. Storefiles</th>
<th>Storefile Size Uncompressed</th>
<th>Storefile Size</th>
<th>Index Size</th>
<th>Bloom Size</th>
<th>Data Locality</th>
</tr>
</thead>
<tbody>
<%for RegionInfo r: onlineRegions %>
<tr>
<%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);
}
}
</%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<%if load != null %>
<td><% String.format("%,1d", load.getStores()) %></td>
<td><% String.format("%,1d", load.getStorefiles()) %></td>
<td><% uncompressedStorefileSizeStr %></td>
<td><% storefileSizeStr %></td>
<td><% indexSizeStr %></td>
<td><% bloomSizeStr %></td>
<td><% load.getDataLocality() %></td>
</%if>
</tr>
</%for>
</tbody>
</table>
</%def>
<%def compactStats>
<%args>
List<RegionInfo> onlineRegions;
</%args>
<table id="compactionStatsTable" class="tablesorter table table-striped">
<thead>
<tr>
<th>Region Name</th>
<th>Num. Compacting Cells</th>
<th>Num. Compacted Cells</th>
<th>Compaction Progress</th>
<th data-date-format="yyyymmdd hhmm zz">Last Major Compaction</th>
</tr>
</thead>
<tbody>
<%for RegionInfo r: onlineRegions %>
<tr>
<%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());
</%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<%if load != null %>
<td><% String.format("%,1d", load.getTotalCompactingKVs()) %></td>
<td><% String.format("%,1d", load.getCurrentCompactedKVs()) %></td>
<td><% percentDone %></td>
<td><% compactTime %></td>
</%if>
</tr>
</%for>
</tbody>
</table>
</%def>
<%def memstoreStats>
<%args>
List<RegionInfo> onlineRegions;
</%args>
<table id="memstoreStatsTable" class="tablesorter table table-striped">
<thead>
<tr>
<th>Region Name</th>
<th>Memstore Size</th>
</tr>
</thead>
<tbody>
<%for RegionInfo r: onlineRegions %>
<tr>
<%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);
}
}
</%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<%if load != null %>
<td><% memStoreSizeMBStr %></td>
</%if>
</tr>
</%for>
</tbody>
</table>
</%def>