You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bb...@apache.org on 2022/06/23 20:47:14 UTC
[hbase] branch branch-2 updated: HBASE-26945 Quotas causes too much load on meta for large clusters (#4576)
This is an automated email from the ASF dual-hosted git repository.
bbeaudreault pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new 409a7a44e8c HBASE-26945 Quotas causes too much load on meta for large clusters (#4576)
409a7a44e8c is described below
commit 409a7a44e8c2928930b5a04bfe86867e53732559
Author: Bryan Beaudreault <bb...@hubspot.com>
AuthorDate: Thu Jun 23 16:47:09 2022 -0400
HBASE-26945 Quotas causes too much load on meta for large clusters (#4576)
Signed-off-by: Xiaolin Ha <ha...@apache.org>
---
.../org/apache/hadoop/hbase/quotas/QuotaCache.java | 28 +++++++++++++---------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java
index 8bac7fd1a61..c8839ad61d1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/QuotaCache.java
@@ -27,12 +27,13 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ClusterMetrics;
import org.apache.hadoop.hbase.ClusterMetrics.Option;
-import org.apache.hadoop.hbase.MetaTableAccessor;
import org.apache.hadoop.hbase.ScheduledChore;
import org.apache.hadoop.hbase.Stoppable;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.RegionStatesCount;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.regionserver.RegionServerServices;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
@@ -352,24 +353,29 @@ public class QuotaCache implements Stoppable {
*/
private void updateQuotaFactors() {
// Update machine quota factor
+ ClusterMetrics clusterMetrics;
try {
- int rsSize = rsServices.getConnection().getAdmin()
- .getClusterMetrics(EnumSet.of(Option.SERVERS_NAME)).getServersName().size();
- if (rsSize != 0) {
- // TODO if use rs group, the cluster limit should be shared by the rs group
- machineQuotaFactor = 1.0 / rsSize;
- }
+ clusterMetrics = rsServices.getConnection().getAdmin()
+ .getClusterMetrics(EnumSet.of(Option.SERVERS_NAME, Option.TABLE_TO_REGIONS_COUNT));
} catch (IOException e) {
- LOG.warn("Get live region servers failed", e);
+ LOG.warn("Failed to get cluster metrics needed for updating quotas", e);
+ return;
+ }
+
+ int rsSize = clusterMetrics.getServersName().size();
+ if (rsSize != 0) {
+ // TODO if use rs group, the cluster limit should be shared by the rs group
+ machineQuotaFactor = 1.0 / rsSize;
}
+ Map<TableName, RegionStatesCount> tableRegionStatesCount =
+ clusterMetrics.getTableRegionStatesCount();
+
// Update table machine quota factors
for (TableName tableName : tableQuotaCache.keySet()) {
double factor = 1;
try {
- long regionSize =
- MetaTableAccessor.getTableRegions(rsServices.getConnection(), tableName, true).stream()
- .filter(regionInfo -> !regionInfo.isOffline()).count();
+ long regionSize = tableRegionStatesCount.get(tableName).getOpenRegions();
if (regionSize == 0) {
factor = 0;
} else {