From b5635eb52a32de71084932536f4c5a01428dd832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Tue, 9 Sep 2025 17:12:14 +0200 Subject: [PATCH 01/17] HBASE-29531 Migrate RegionServer Status Jamon page back to JSP --- .../regionserver/regionserver.jsp | 127 +++++++++++++++++- .../regionserver/serverMetrics.jsp | 55 ++++++++ .../regionserver/serverMetricsBaseStats.jsp | 49 +++++++ .../serverMetricsByteBuffAllocatorStats.jsp | 51 +++++++ .../regionserver/serverMetricsMemoryStats.jsp | 78 +++++++++++ .../regionserver/serverMetricsQueueStats.jsp | 53 ++++++++ .../serverMetricsRequestStats.jsp | 46 +++++++ .../regionserver/serverMetricsStoreStats.jsp | 49 +++++++ .../regionserver/serverMetricsWalStats.jsp | 50 +++++++ 9 files changed, 557 insertions(+), 1 deletion(-) create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetrics.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsBaseStats.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsByteBuffAllocatorStats.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsMemoryStats.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsQueueStats.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsRequestStats.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsStoreStats.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsWalStats.jsp diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp index ee63075d5d6d..dc85bb7c0f52 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp @@ -17,4 +17,129 @@ * limitations under the License. */ --%> - +<%@ page contentType="text/html;charset=UTF-8" + import="java.util.*" + import="org.apache.hadoop.hbase.ServerName" + import="org.apache.hadoop.hbase.master.HMaster" + import="org.apache.hadoop.conf.Configuration" + import="org.apache.hadoop.hbase.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.client.RegionInfo" + import="org.apache.hadoop.hbase.ServerName" + import="org.apache.hadoop.hbase.HBaseConfiguration" + import="org.apache.hadoop.hbase.io.hfile.CacheConfig" + import="org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil" + import="org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ServerInfo" + import="org.apache.hadoop.hbase.util.JvmVersion" + import="org.apache.hadoop.hbase.zookeeper.MasterAddressTracker" %> + +<%! + public String formatZKString(HRegionServer regionServer) { + 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(); + } +%> + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + String format = request.getParameter("format"); + if (format == null) { + format = "html"; + } + if ("json".equals(format)) { + response.setContentType("application/json"); + } else { + response.setContentType("text/html"); + } + + if (!regionServer.isOnline()) { + response.getWriter().write("The RegionServer is initializing!"); + response.getWriter().close(); + return; + } + + String filter = request.getParameter("filter"); + if (filter == null) { + filter = "general"; + } + String bcn = request.getParameter("bcn"); + String bcv = request.getParameter("bcv"); +%> + +<%-- 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) { %> + <%-- TODO: Migrate BlockCacheViewTmpl --%> + <& BlockCacheViewTmpl; conf = regionServer.getConfiguration(); cacheConfig = new CacheConfig(regionServer.getConfiguration()); bcn = bcn; bcv = bcv; blockCache = regionServer.getBlockCache().orElse(null) &> +<% + return; + } + else if (format.equals("json")) { + request.setAttribute(MasterStatusConstants.FILTER, filter); + request.setAttribute(MasterStatusConstants.FORMAT, "json"); %> + +<% + return; + } + + 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(); + + String title = "HBase Region Server: " + serverName.getHostname(); + pageContext.setAttribute("pageTitle", title); +%> + + + + + +
+
+ +
+
+ +
+

Server Metrics

+ +
+ +
+

Block Cache

+ <& BlockCacheTmpl; cacheConfig = new CacheConfig(regionServer.getConfiguration()); config = regionServer.getConfiguration(); bc = regionServer.getBlockCache().orElse(null) &> +
+ +
+
+ + + + diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetrics.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetrics.jsp new file mode 100644 index 000000000000..08af35feb665 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetrics.jsp @@ -0,0 +1,55 @@ +<%-- +/** + * 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" %> + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsBaseStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsBaseStats.jsp new file mode 100644 index 000000000000..59c2c46fe5c9 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsBaseStats.jsp @@ -0,0 +1,49 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.regionserver.MetricsRegionServerWrapper" %> + + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + MetricsRegionServerWrapper mWrap = regionServer.getMetrics().getRegionServerWrapper(); +%> + + + + + + + + + + + + + + + + +
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() %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsByteBuffAllocatorStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsByteBuffAllocatorStats.jsp new file mode 100644 index 000000000000..65334a20c238 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsByteBuffAllocatorStats.jsp @@ -0,0 +1,51 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" + import="org.apache.hadoop.hbase.io.ByteBuffAllocator" %> + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + ByteBuffAllocator bbAllocator = regionServer.getRpcServer().getByteBuffAllocator(); +%> + + + + + + + + + + + + + + + + + + +
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/resources/hbase-webapps/regionserver/serverMetricsMemoryStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsMemoryStats.jsp new file mode 100644 index 000000000000..b3a0443add63 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsMemoryStats.jsp @@ -0,0 +1,78 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.regionserver.MetricsRegionServerWrapper" + import="java.lang.management.MemoryUsage" + import="org.apache.hadoop.hbase.io.util.MemorySizeUtil" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" %> + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + MetricsRegionServerWrapper mWrap = regionServer.getMetrics().getRegionServerWrapper(); + + 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) %> +
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsQueueStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsQueueStats.jsp new file mode 100644 index 000000000000..3a6bc509fded --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsQueueStats.jsp @@ -0,0 +1,53 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.regionserver.MetricsRegionServerWrapper" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" + import="org.apache.hadoop.hbase.ipc.MetricsHBaseServerWrapper" %> + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + MetricsRegionServerWrapper mWrap = regionServer.getMetrics().getRegionServerWrapper(); + MetricsHBaseServerWrapper mServerWrap = regionServer.getRpcServer().getMetrics().getHBaseServerWrapper(); +%> + + + + + + + + + + + + + + + + + + +
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) %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsRequestStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsRequestStats.jsp new file mode 100644 index 000000000000..bf435884b3df --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsRequestStats.jsp @@ -0,0 +1,46 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.regionserver.MetricsRegionServerWrapper" %> + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + MetricsRegionServerWrapper mWrap = regionServer.getMetrics().getRegionServerWrapper(); +%> + + + + + + + + + + + + + + +
Request Per SecondRead Request CountFiltered Read Request CountWrite Request Count
<%= String.format("%.0f", mWrap.getRequestsPerSecond()) %><%= mWrap.getReadRequestsCount() %><%= mWrap.getFilteredReadRequestsCount() %><%= mWrap.getWriteRequestsCount() %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsStoreStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsStoreStats.jsp new file mode 100644 index 000000000000..2da3ea0bba0f --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsStoreStats.jsp @@ -0,0 +1,49 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.regionserver.MetricsRegionServerWrapper" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" %> + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + MetricsRegionServerWrapper mWrap = regionServer.getMetrics().getRegionServerWrapper(); +%> + + + + + + + + + + + + + + + + +
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) %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsWalStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsWalStats.jsp new file mode 100644 index 000000000000..d172a86feffc --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/serverMetricsWalStats.jsp @@ -0,0 +1,50 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.regionserver.MetricsRegionServerWrapper" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" %> + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + MetricsRegionServerWrapper mWrap = regionServer.getMetrics().getRegionServerWrapper(); +%> + + + + + + + + + + + + +
Num. WAL FilesSize. WAL FilesWAL exclude DNs
<%= mWrap.getNumWALFiles() %><%= TraditionalBinaryPrefix.long2String(mWrap.getWALFileSize(), "B", 1) %> + <% for (String exclude: mWrap.getWALExcludeDNs()) { %> + <%= exclude %>
+ <% } %> + +
From 9a11397960201aa00cf75dd14f87c27e37ae3fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Wed, 10 Sep 2025 12:04:05 +0200 Subject: [PATCH 02/17] HBASE-29531 BlockCache --- .../tmpl/regionserver/BlockCacheTmpl.jamon | 127 +------------- .../hbase-webapps/regionserver/blockCache.jsp | 72 ++++++++ .../regionserver/blockCacheBaseInfo.jsp | 42 +++++ .../regionserver/blockCacheConfig.jsp | 72 ++++++++ .../regionserver/blockCacheEvictions.jsp | 45 +++++ .../regionserver/blockCacheHits.jsp | 92 ++++++++++ .../regionserver/blockCacheLevel.jsp | 159 ++++++++++++++++++ .../regionserver/blockCacheStats.jsp | 58 +++++++ .../regionserver/regionserver.jsp | 6 +- .../hbase-webapps/static/css/hbase.css | 29 ++++ .../hbase-webapps/static/js/blockCacheInit.js | 120 +++++++++++++ 11 files changed, 695 insertions(+), 127 deletions(-) create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/blockCache.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheBaseInfo.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheConfig.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheEvictions.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheHits.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheLevel.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheStats.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/static/js/blockCacheInit.js 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 82609aad7190..2e13b5acc685 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 @@ -204,103 +204,7 @@ org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix; } <%if hitPeriods > 0 %> - + Hits @@ -358,35 +262,6 @@ org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix; <% 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/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/regionserver.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp index dc85bb7c0f52..21ba67a11c37 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp @@ -34,6 +34,7 @@ import="org.apache.hadoop.hbase.zookeeper.MasterAddressTracker" %> <%! + // TODO: Can we share with softwareAttributes.jsp? public String formatZKString(HRegionServer regionServer) { StringBuilder quorums = new StringBuilder(); String zkQuorum = regionServer.getZooKeeper().getQuorum(); @@ -134,9 +135,12 @@

Block Cache

- <& BlockCacheTmpl; cacheConfig = new CacheConfig(regionServer.getConfiguration()); config = regionServer.getConfiguration(); bc = regionServer.getBlockCache().orElse(null) &> +
+ + <%-- TODO: Migrate rest of RSStatusTmpl.jamon --%> + diff --git a/hbase-server/src/main/resources/hbase-webapps/static/css/hbase.css b/hbase-server/src/main/resources/hbase-webapps/static/css/hbase.css index d1ae4ace7f4f..46d8ca96f202 100644 --- a/hbase-server/src/main/resources/hbase-webapps/static/css/hbase.css +++ b/hbase-server/src/main/resources/hbase-webapps/static/css/hbase.css @@ -152,3 +152,32 @@ table.tablesorter thead tr .tablesorter-headerDesc { table.nowrap th, table.nowrap td { white-space: nowrap; } + +/* Block Cache pagination */ +.pagination-container { + display: flex; + align-items: center; + gap: 8px; + padding: 10px 0; +} + +.page-numbers { + display: flex; + gap: 4px; +} + +.page-number { + min-width: 30px; + text-align: center; +} + +.page-number.active { + font-weight: bold; + background-color: #eee; +} + +.page-info { + margin-left: 15px; + font-size: 0.9em; + color: #666; +} diff --git a/hbase-server/src/main/resources/hbase-webapps/static/js/blockCacheInit.js b/hbase-server/src/main/resources/hbase-webapps/static/js/blockCacheInit.js new file mode 100644 index 000000000000..164ad9752e5a --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/static/js/blockCacheInit.js @@ -0,0 +1,120 @@ +/* + * Copyright The Apache Software Foundation + * + * 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 script displays and paginates the initially hidden table rows of Hit Ratios for time periods. + * See: HBASE-29276 Compute and display hit ratio by configurable, granular time periods + */ + +// Wait for document to be fully loaded +document.addEventListener('DOMContentLoaded', function() { + + // Count actual items in the DOM + const itemRows = document.querySelectorAll('tr.item-row'); + + // Pagination state + let currentPage = 1; + const pageSize = 10; + const totalItems = itemRows.length; + const totalPages = Math.ceil(totalItems / pageSize); + + // Create page buttons + const pageButtonsContainer = document.getElementById('page-buttons'); + if (pageButtonsContainer) { + for (let i = 1; i <= totalPages; i++) { + const button = document.createElement('button'); + button.className = 'page-number'; + button.textContent = i; + button.onclick = function() { goToPage(i); }; + pageButtonsContainer.appendChild(button); + } + } + function displayItems() { + // Hide all item rows + itemRows.forEach(row => { + row.style.display = 'none'; + }); + + // Calculate indexes + const startIndex = (currentPage - 1) * pageSize; + const endIndex = Math.min(startIndex + pageSize, totalItems); + + // Show rows for current page + let displayedCount = 0; + for (let i = startIndex; i < endIndex; i++) { + const row = document.getElementById('row-' + i); + if (row) { + row.style.display = 'table-row'; + displayedCount++; + } + } + + // Update pagination UI + document.querySelectorAll('.page-number').forEach(btn => { + if (parseInt(btn.textContent) === currentPage) { + btn.classList.add('active'); + } else { + btn.classList.remove('active'); + } + }); + + const prevBtn = document.getElementById('prev-page'); + const nextBtn = document.getElementById('next-page'); + + if (prevBtn) prevBtn.disabled = currentPage === 1; + if (nextBtn) nextBtn.disabled = currentPage === totalPages; + + // Update page info + const pageInfo = document.getElementById('page-info'); + if (pageInfo) { + pageInfo.textContent = `Showing ${startIndex + 1} to ${endIndex} of ${totalItems} items`; + } + } + + function goToPage(page) { + if (page >= 1 && page <= totalPages) { + currentPage = page; + displayItems(); + } + } + + window.nextPage = function() { + goToPage(currentPage + 1); + }; + + window.prevPage = function() { + goToPage(currentPage - 1); + }; + + window.goToPage = goToPage; + + // Check URL for initial page + const urlParams = new URLSearchParams(window.location.search); + const pageParam = urlParams.get('page'); + if (pageParam) { + const parsedPage = parseInt(pageParam); + if (!isNaN(parsedPage) && parsedPage >= 1) { + currentPage = parsedPage; + } + } + + // Initial display + displayItems(); +}); From b9ebdc97005396af427d03c37f10b703183888e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Thu, 11 Sep 2025 17:52:25 +0200 Subject: [PATCH 03/17] HBASE-29531 BlockCache view, reuse common JSP-s, TaskMonitor Also fix content-type of master JSON task view. --- hbase-server/pom.xml | 18 +++++- .../{master => common}/taskMonitor.jsp | 0 .../taskMonitorRenderTasks.jsp | 0 .../resources/hbase-webapps/master/master.jsp | 2 + .../regionserver/blockCacheView.jsp | 61 +++++++++++++++++++ .../regionserver/regionserver.jsp | 55 ++++++----------- 6 files changed, 97 insertions(+), 39 deletions(-) rename hbase-server/src/main/resources/hbase-webapps/{master => common}/taskMonitor.jsp (100%) rename hbase-server/src/main/resources/hbase-webapps/{master => common}/taskMonitorRenderTasks.jsp (100%) create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheView.jsp 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/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/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/regionserver/blockCacheView.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheView.jsp new file mode 100644 index 000000000000..91856dce2f79 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheView.jsp @@ -0,0 +1,61 @@ +<%-- +/** + * 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" %><% + // 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("bcn"); + String bcv = (String) request.getAttribute("bcv"); + BlockCache bc = (BlockCache) request.getAttribute("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; + } + BlockCacheUtil.CachedBlocksByFile cbsbf = BlockCacheUtil.getLoadedCachedBlocksByFile(conf, bc); + if (bcv.equals("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/regionserver.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp index 21ba67a11c37..3dd9ae248896 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp @@ -31,37 +31,7 @@ import="org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil" import="org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ServerInfo" import="org.apache.hadoop.hbase.util.JvmVersion" - import="org.apache.hadoop.hbase.zookeeper.MasterAddressTracker" %> - -<%! - // TODO: Can we share with softwareAttributes.jsp? - public String formatZKString(HRegionServer regionServer) { - 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(); - } -%> - -<% + import="org.apache.hadoop.hbase.zookeeper.MasterAddressTracker" %><% HRegionServer regionServer = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); @@ -87,12 +57,16 @@ } String bcn = request.getParameter("bcn"); String bcv = request.getParameter("bcv"); -%> - -<%-- 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) { %> - <%-- TODO: Migrate BlockCacheViewTmpl --%> - <& BlockCacheViewTmpl; conf = regionServer.getConfiguration(); cacheConfig = new CacheConfig(regionServer.getConfiguration()); bcn = bcn; bcv = bcv; blockCache = regionServer.getBlockCache().orElse(null) &> + if (bcv == null) { + bcv = ""; + } + // 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) { + request.setAttribute("conf", regionServer.getConfiguration()); + request.setAttribute("bcn", bcn); + request.setAttribute("bcv", bcv); + request.setAttribute("blockCache", regionServer.getBlockCache().orElse(null)); +%> <% return; } @@ -138,12 +112,19 @@ +
+ <% request.setAttribute("parent", "/regionserver.jsp"); %> + +
+ <%-- TODO: Migrate rest of RSStatusTmpl.jamon --%> +<%-- TODO: We also need /static/js/jquery.tablesorter.min.js and the init JS code here! --%> + From 461b2e3501399c65e2d076b3d66cf7ad347b9cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Fri, 12 Sep 2025 15:29:47 +0200 Subject: [PATCH 04/17] HBASE-29531 Region list --- .../hbase-webapps/regionserver/regionList.jsp | 75 +++++++++++ .../regionserver/regionListBaseInfo.jsp | 58 +++++++++ .../regionserver/regionListCompactStats.jsp | 79 ++++++++++++ .../regionserver/regionListMemstoreStats.jsp | 70 +++++++++++ .../regionserver/regionListRequestStats.jsp | 61 +++++++++ .../regionserver/regionListStoreStats.jsp | 119 ++++++++++++++++++ .../regionserver/regionserver.jsp | 6 + 7 files changed, 468 insertions(+) create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/regionList.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/regionListBaseInfo.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/regionListCompactStats.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/regionListMemstoreStats.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/regionListRequestStats.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/regionListStoreStats.jsp diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionList.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionList.jsp new file mode 100644 index 000000000000..4dc03adb1d0a --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionList.jsp @@ -0,0 +1,75 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.client.RegionInfo" %> +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + List onlineRegions = (List) request.getAttribute("onlineRegions"); + + if (onlineRegions != null && onlineRegions.size() > 0) { + + Collections.sort(onlineRegions, RegionInfo.COMPARATOR); +%> +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+

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

+<% } %> + diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListBaseInfo.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListBaseInfo.jsp new file mode 100644 index 000000000000..a70819d8e9a0 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListBaseInfo.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="java.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.client.RegionInfo" + import="org.apache.hadoop.hbase.client.RegionInfoDisplay" + import="org.apache.hadoop.hbase.util.Bytes" %> +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + List onlineRegions = (List) request.getAttribute("onlineRegions"); +%> + + + + + + + + + + + + <% for (RegionInfo r: onlineRegions) { %> + + <% + 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() %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListCompactStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListCompactStats.jsp new file mode 100644 index 000000000000..07cf41e83348 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListCompactStats.jsp @@ -0,0 +1,79 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.client.RegionInfo" + import="org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.RegionLoad" + import="org.apache.commons.lang3.time.FastDateFormat" + import="org.apache.hadoop.hbase.client.RegionInfoDisplay" %> +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + List onlineRegions = (List) request.getAttribute("onlineRegions"); + +%> + + + + + + + + + + + + + <% for (RegionInfo r: onlineRegions) { %> + + + <% + 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 %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListMemstoreStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListMemstoreStats.jsp new file mode 100644 index 000000000000..b81e42ce6dd9 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListMemstoreStats.jsp @@ -0,0 +1,70 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.client.RegionInfo" + import="org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos" + import="org.apache.hadoop.hbase.client.RegionInfoDisplay" %> +<%@ page import="org.apache.hadoop.util.StringUtils" %> +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + List onlineRegions = (List) request.getAttribute("onlineRegions"); + +%> + + + + + + + + + + <% for (RegionInfo r: onlineRegions) { %> + + + <% + final String ZEROMB = "0 MB"; + String memStoreSizeMBStr = ZEROMB; + ClusterStatusProtos.RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); + String displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(r, + regionServer.getConfiguration()); + if (load != null) { + long memStoreSizeMB = load.getMemStoreSizeMB(); + if (memStoreSizeMB > 0) { + memStoreSizeMBStr = StringUtils.TraditionalBinaryPrefix.long2String( + memStoreSizeMB * StringUtils.TraditionalBinaryPrefix.MEGA.value, "B", 1); + } + } + %> + + + <% if (load != null) { %> + + <% } %> + + + <% } %> + +
Region NameMemstore Size
<%= displayName %><%= memStoreSizeMBStr %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListRequestStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListRequestStats.jsp new file mode 100644 index 000000000000..2d0ef5cd1d25 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListRequestStats.jsp @@ -0,0 +1,61 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.client.RegionInfo" + import="org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos" + import="org.apache.hadoop.hbase.client.RegionInfoDisplay" %> +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + List onlineRegions = (List) request.getAttribute("onlineRegions"); +%> + + + + + + + + + + + + <% for (RegionInfo r: onlineRegions) { %> + + + <% + ClusterStatusProtos.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()) %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListStoreStats.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListStoreStats.jsp new file mode 100644 index 000000000000..b663b74536e9 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionListStoreStats.jsp @@ -0,0 +1,119 @@ +<%-- +/** + * 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.util.*" + import="org.apache.hadoop.hbase.client.RegionInfo" + import="org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos" + import="org.apache.hadoop.hbase.client.RegionInfoDisplay" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" + import="org.apache.hadoop.hbase.regionserver.*" + import="org.apache.hadoop.util.StringUtils" %> +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + List onlineRegions = (List) request.getAttribute("onlineRegions"); +%> + + + + + + + + + + + + + + + + + + + <% for (RegionInfo r: onlineRegions) { %> + + <% + final String ZEROMB = "0 MB"; + final String ZEROKB = "0 KB"; + String uncompressedStorefileSizeStr = ZEROMB; + String storefileSizeStr = ZEROMB; + String indexSizeStr = ZEROKB; + String bloomSizeStr = ZEROKB; + ClusterStatusProtos.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) %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp index 3dd9ae248896..d39b6a80fe0c 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp @@ -117,6 +117,12 @@ +
+

Regions

+ <% request.setAttribute("onlineRegions", onlineRegions); %> + +
+ <%-- TODO: Migrate rest of RSStatusTmpl.jamon --%> From 625daa5efa17e1a3eb9c6d44e932368bf7b502b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Fri, 12 Sep 2025 18:44:48 +0200 Subject: [PATCH 05/17] HBASE-29531 Region Server Status page scripts --- .../hbase-webapps/regionserver/footer.jsp | 10 +-- .../regionserver/regionserver.jsp | 12 +-- .../hbase-webapps/regionserver/scripts.jsp | 28 ++++++ .../static/js/regionServerStatusInit.js | 86 +++++++++++++++++++ 4 files changed, 121 insertions(+), 15 deletions(-) create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/scripts.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/static/js/regionServerStatusInit.js 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/regionserver.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp index d39b6a80fe0c..5e3ea2dd006a 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp @@ -126,11 +126,11 @@ <%-- TODO: Migrate rest of RSStatusTmpl.jamon --%> - + -<%-- TODO: We also need /static/js/jquery.tablesorter.min.js and the init JS code here! --%> - - - - + + + + + diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/scripts.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/scripts.jsp new file mode 100644 index 000000000000..d987621a119d --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/scripts.jsp @@ -0,0 +1,28 @@ +<%-- +/** +* 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. +*/ +--%> + + + + diff --git a/hbase-server/src/main/resources/hbase-webapps/static/js/regionServerStatusInit.js b/hbase-server/src/main/resources/hbase-webapps/static/js/regionServerStatusInit.js new file mode 100644 index 000000000000..f65ffdab8760 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/static/js/regionServerStatusInit.js @@ -0,0 +1,86 @@ +/* + * Copyright The Apache Software Foundation + * + * 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. + */ + +$(document).ready(function() + { + $.tablesorter.addParser({ + id: 'filesize', + is: function(s) { + return s.match(new RegExp( /([\.0-9]+)\ (B|KB|MB|GB|TB)/ )); + }, + format: function(s) { + var suf = s.match(new RegExp( /(KB|B|GB|MB|TB)$/ ))[1]; + var num = parseFloat(s.match( new RegExp( /([\.0-9]+)\ (B|KB|MB|GB|TB)/ ))[0]); + switch(suf) { + case 'B': + return num; + case 'KB': + return num * 1024; + case 'MB': + return num * 1024 * 1024; + case 'GB': + return num * 1024 * 1024 * 1024; + case 'TB': + return num * 1024 * 1024 * 1024 * 1024; + } + }, + type: 'numeric' + }); + $.tablesorter.addParser( + { + id: "separator", + is: function (s) { + return /^[0-9]?[0-9,]*$/.test(s); + }, + format: function (s) { + return $.tablesorter.formatFloat( s.replace(/,/g,'') ); + }, + type: "numeric" + }); + + $("#baseStatsTable").tablesorter({ + headers: { + '.cls_emptyMin': {empty: 'emptyMin'}, + '.cls_emptyMax': {empty: 'emptyMax'} + } + }); + $("#requestStatsTable").tablesorter({ + headers: { + '.cls_separator': {sorter: 'separator'} + } + }); + $("#storeStatsTable").tablesorter({ + headers: { + '.cls_separator': {sorter: 'separator'}, + '.cls_filesize': {sorter: 'filesize'} + } + }); + $("#compactionStatsTable").tablesorter({ + headers: { + '.cls_separator': {sorter: 'separator'} + } + }); + $("#memstoreStatsTable").tablesorter({ + headers: { + '.cls_filesize': {sorter: 'filesize'} + } + }); + } +); From c03d887f8f7082bd115d33f4bcf20061124959d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Mon, 15 Sep 2025 09:54:23 +0200 Subject: [PATCH 06/17] HBASE-29531 Replication Status --- .../regionserver/regionserver.jsp | 4 ++ .../regionserver/replicationStatus.jsp | 53 +++++++++++++++++++ .../replicationStatusCurrentLog.jsp | 47 ++++++++++++++++ .../replicationStatusReplicationDelay.jsp | 44 +++++++++++++++ 4 files changed, 148 insertions(+) create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatus.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatusCurrentLog.jsp create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatusReplicationDelay.jsp diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp index 5e3ea2dd006a..4df9d6acf0c5 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp @@ -123,6 +123,10 @@ +
+

Replication Status

+ +
<%-- TODO: Migrate rest of RSStatusTmpl.jamon --%> diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatus.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatus.jsp new file mode 100644 index 000000000000..9825669b0a1c --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatus.jsp @@ -0,0 +1,53 @@ +<%-- +/** + * 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.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import ="org.apache.hadoop.hbase.replication.regionserver.ReplicationStatus" %> +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + Map walGroupsReplicationStatus = regionServer.getWalGroupsReplicationStatus(); + + if (walGroupsReplicationStatus != null && walGroupsReplicationStatus.size() > 0) { +%> + +
+ +
+ <% request.setAttribute("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

+<% } %> diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatusCurrentLog.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatusCurrentLog.jsp new file mode 100644 index 000000000000..254620139dec --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatusCurrentLog.jsp @@ -0,0 +1,47 @@ +<%-- +/** + * 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.procedure2.util.StringUtils" + import ="org.apache.hadoop.hbase.replication.regionserver.ReplicationStatus" %> +<% + Map metrics = (Map) request.getAttribute("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()) %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatusReplicationDelay.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatusReplicationDelay.jsp new file mode 100644 index 000000000000..19ea1f28b5d8 --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/replicationStatusReplicationDelay.jsp @@ -0,0 +1,44 @@ +<%-- +/** + * 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.procedure2.util.StringUtils" + import ="org.apache.hadoop.hbase.replication.regionserver.ReplicationStatus" %> +<% + Map metrics = (Map) request.getAttribute("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()) %>
From 9f9c0d1de50eae1521b980d8138a15b0d9564e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Mon, 15 Sep 2025 10:41:11 +0200 Subject: [PATCH 07/17] HBASE-29531 Software Attributes section Also share formatZKString method with Master Status page. --- .../org/apache/hadoop/hbase/util/ZKUtil.java | 57 +++++++++ .../master/softwareAttributes.jsp | 34 +----- .../regionserver/regionserver.jsp | 12 +- .../regionserver/softwareAttributes.jsp | 114 ++++++++++++++++++ 4 files changed, 181 insertions(+), 36 deletions(-) create mode 100644 hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKUtil.java create mode 100644 hbase-server/src/main/resources/hbase-webapps/regionserver/softwareAttributes.jsp diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKUtil.java new file mode 100644 index 000000000000..fcfee604b848 --- /dev/null +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKUtil.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 class ZKUtil { + + private ZKUtil() { + // 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/softwareAttributes.jsp b/hbase-server/src/main/resources/hbase-webapps/master/softwareAttributes.jsp index 725a116790c9..8d07adbb4a45 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.ZKUtil" %> <% HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER); @@ -111,7 +85,7 @@ ZooKeeper Quorum - <%= formatZKString(master) %> + <%= ZKUtil.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 %> + <%= ZKUtil.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/regionserver/regionserver.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp index 4df9d6acf0c5..5129db7446b3 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp @@ -20,17 +20,12 @@ <%@ page contentType="text/html;charset=UTF-8" import="java.util.*" import="org.apache.hadoop.hbase.ServerName" - import="org.apache.hadoop.hbase.master.HMaster" - import="org.apache.hadoop.conf.Configuration" import="org.apache.hadoop.hbase.util.*" import="org.apache.hadoop.hbase.regionserver.HRegionServer" import="org.apache.hadoop.hbase.client.RegionInfo" import="org.apache.hadoop.hbase.ServerName" - import="org.apache.hadoop.hbase.HBaseConfiguration" - import="org.apache.hadoop.hbase.io.hfile.CacheConfig" import="org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil" import="org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ServerInfo" - import="org.apache.hadoop.hbase.util.JvmVersion" import="org.apache.hadoop.hbase.zookeeper.MasterAddressTracker" %><% HRegionServer regionServer = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); @@ -128,7 +123,12 @@ - <%-- TODO: Migrate rest of RSStatusTmpl.jamon --%> +
+

Software Attributes

+ <% request.setAttribute("masterServerName", masterServerName); %> + <% request.setAttribute("infoPort", infoPort); %> + +
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/softwareAttributes.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/softwareAttributes.jsp new file mode 100644 index 000000000000..590771f9c43f --- /dev/null +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/softwareAttributes.jsp @@ -0,0 +1,114 @@ +<%-- +/** + * 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.util.JvmVersion" + import="org.apache.hadoop.hbase.regionserver.HRegionServer" + import="org.apache.hadoop.hbase.ServerName" + import="org.apache.hadoop.hbase.util.ZKUtil"%> + +<% + HRegionServer regionServer = + (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); + + ServerName masterServerName = (ServerName) request.getAttribute("masterServerName"); + int infoPort = (int) request.getAttribute("infoPort"); +%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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<%= ZKUtil.formatZKString(regionServer.getZooKeeper()) %>Addresses of all registered ZK servers
Coprocessors<%= 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 { + String host = masterServerName.getHostname() + ":" + infoPort; + String url = "//" + host + "/master.jsp"; + %> + <%= host %> + <% } %> + Address of HBase Master
From a59d17970b667e38808ad5adf8cc35a625513bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Mon, 15 Sep 2025 10:44:24 +0200 Subject: [PATCH 08/17] HBASE-29531 Remove RegionServer Status related Jamon files --- .../tmpl/regionserver/BlockCacheTmpl.jamon | 439 ------------------ .../regionserver/BlockCacheViewTmpl.jamon | 80 ---- .../tmpl/regionserver/RSStatusTmpl.jamon | 330 ------------- .../tmpl/regionserver/RegionListTmpl.jamon | 338 -------------- .../regionserver/ReplicationStatusTmpl.jamon | 105 ----- .../tmpl/regionserver/ServerMetricsTmpl.jamon | 265 ----------- 6 files changed, 1557 deletions(-) delete mode 100644 hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon delete mode 100644 hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheViewTmpl.jamon delete mode 100644 hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon delete mode 100644 hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon delete mode 100644 hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ReplicationStatusTmpl.jamon delete mode 100644 hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon 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 2e13b5acc685..000000000000 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon +++ /dev/null @@ -1,439 +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) %>
- From cb524a47b84354383c3b5e9d417e2ece3490c60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Mon, 15 Sep 2025 10:45:03 +0200 Subject: [PATCH 09/17] HBASE-29531 Remove TaskMonitorTmpl.jamon previously shared Jamon file --- .../hbase/tmpl/common/TaskMonitorTmpl.jamon | 140 ------------------ 1 file changed, 140 deletions(-) delete mode 100644 hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/common/TaskMonitorTmpl.jamon 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> } - From 85b2160452f237e3991753d85e939013d8331e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Mon, 15 Sep 2025 11:38:54 +0200 Subject: [PATCH 10/17] HBASE-29531 Change links from /rs-status to /regionserver.jsp --- .../hbase/master/http/MasterStatusUtil.java | 2 +- .../regionserver/http/RSStatusServlet.java | 33 +++---------------- .../resources/hbase-webapps/master/hbck.jsp | 2 +- .../hbase-webapps/master/rsgroup.jsp | 23 ++++--------- .../resources/hbase-webapps/master/table.jsp | 10 +++--- .../hbase-webapps/regionserver/header.jsp | 4 +-- .../hbase-webapps/regionserver/index.html | 2 +- .../apache/hadoop/hbase/TestInfoServers.java | 5 +-- .../master/http/TestMasterStatusUtil.java | 3 +- ...atusServlet.java => TestRSStatusPage.java} | 27 ++++++++------- .../src/main/ruby/hbase/taskmonitor.rb | 4 +-- 11 files changed, 44 insertions(+), 71 deletions(-) rename hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/http/{TestRSStatusServlet.java => TestRSStatusPage.java} (92%) 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/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/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/rsgroup.jsp b/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp index c86c9902ea1b..de72994f85da 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp @@ -42,6 +42,7 @@ <%@ page import="org.apache.hadoop.hbase.ServerMetrics" %> <%@ page import="org.apache.hadoop.hbase.Size" %> <%@ page import="org.apache.hadoop.hbase.RegionMetrics" %> +<%@ page import="static org.apache.hadoop.hbase.util.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/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/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 @@