Duo Zhang created HBASE-25832: --------------------------------- Summary: Performance improvements for StochasticLoadBalancer Key: HBASE-25832 URL: https://issues.apache.org/jira/browse/HBASE-25832 Project: HBase Issue Type: Improvement Components: Balancer, Performance Reporter: Duo Zhang
This is what I posted in the slack channel. {quote} When refactoring balancer related code for moving them out to hbase-balancer module, I found that we will create a OffPeakHours instance in MoveCostFunction.cost every time. So I wrote a simple JMH test to test its performance. https://github.com/Apache9/hbase-jmh-test/blob/master/src/main/java/org/apache/hadoop/hbase/master/balancer/MoveCostFunctionBenchmark.java For the original version, the result is Benchmark Mode Samples Score Score error Units o.a.h.h.m.b.MoveCostFunctionBenchmark.computeCost avgt 10 242.312 3.853 ns/op 12:06 If I initialized OffPeakHours in constructor, then the result is Benchmark Mode Samples Score Score error Units o.a.h.h.m.b.MoveCostFunctionBenchmark.computeCost avgt 10 81.186 0.720 ns/op 12:06 If I also eliminate the conf.getFloat in the cost method(by storing them to a field member in constructor, the result is Benchmark Mode Samples Score Score error Units o.a.h.h.m.b.MoveCostFunctionBenchmark.computeCost avgt 10 4.419 0.035 ns/op 12:08 I think on a large cluster, the performance for balancer is a problem, so maybe we should try to avoid creating too many objects or calling conf.getXXX in the critical path? As we will call StochasticLoadBalancer.computeCost in every step when balancing cluster... {quote} For large clusters, the performance of StochasticLoadBalancer will be very important, so I think we need to treat this problem seriously and try to improve. -- This message was sent by Atlassian Jira (v8.3.4#803005)