wchevreuil commented on code in PR #4799:
URL: https://github.com/apache/hbase/pull/4799#discussion_r1124335455


##########
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/PrefetchCacheCostFunction.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.master.balancer;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * Compute the cost of a potential cluster configuration based on the number 
of HFile's already
+ * cached in the bucket cache
+ */
[email protected]
+public class PrefetchCacheCostFunction extends CostFunction {
+  private static final String PREFETCH_CACHE_COST_KEY =
+    "hbase.master.balancer.stochastic.prefetchCacheCost";
+  private static final float DEFAULT_PREFETCH_COST = 500;
+
+  private String prefetchedFileListPath;
+  private double prefetchRatio;
+  private float bestPrefetchRatio;
+
+  /**
+   * Enables or disables the prefetch cache cost function depending on the 
parameter
+   * PREFETCH_PERSISTENCE_PATH_KEY. If set, this parameter enables the 
prefetched file list
+   * persistence. If this parameter is not set this means that the cache 
persistence is disabled
+   * which means that the prefetch ratios of regions on region servers cannot 
be calculated and
+   * hence the regions should be moved based on how much they have been 
prefetched on a region
+   * server. The prefetch cache cost function is disabled if the multiplier is 
set to 0.

Review Comment:
   Let's also mention this:
   
   The prefetch ratio function would be most relevant for non-hdfs deployments, 
which then makes locality irrelevant. In those cases, prefetch and region 
skewness would be competing to prevail over the final balancer decision.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to