Apache9 commented on pull request #3276:
URL: https://github.com/apache/hbase/pull/3276#issuecomment-845261501


   Wrote a simple test to verify the performance improvement
   ```
   /**
    * 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 java.util.List;
   import java.util.Map;
   import org.apache.hadoop.hbase.ServerName;
   import org.apache.hadoop.hbase.TableName;
   import org.apache.hadoop.hbase.client.RegionInfo;
   
   public class StohasticBalancerPerformanceEvaluation extends 
StochasticBalancerTestBase {
   
     private void runBalancer(int numNodes, int numRegions, int 
numRegionsPerServer, int numTables,
       int replication) {
       Map<ServerName, List<RegionInfo>> serverMap =
         createServerMap(numNodes, numRegions, numRegionsPerServer, 
replication, numTables);
       Map<TableName, Map<ServerName, List<RegionInfo>>> LoadOfAllTable =
         (Map) mockClusterServersWithTables(serverMap);
       loadBalancer.balanceCluster(LoadOfAllTable);
     }
   
     public void run() throws Exception {
       beforeAllTests();
       loadBalancer.setRackManager(null);
       int numNodes = 1000;
       int numRegions = 100000; // 100 regions per RS
       int numRegionsPerServer = 80; // all servers except one
       int numTables = 100;
       int replication = 1;
       for (int i = 0; i < 3; i++) {
         runBalancer(numNodes, numRegions, numRegionsPerServer, numTables, 
replication);
       }
       long startTimeNs = System.nanoTime();
       runBalancer(numNodes, numRegions, numRegionsPerServer, numTables, 
replication);
       long costNs = System.nanoTime() - startTimeNs;
       System.out.println(String.format("Total time: %.3f secs", (double) 
costNs / 1000000000L));
     }
   
     public static void main(String[] args) throws Exception {
       new StohasticBalancerPerformanceEvaluation().run();
     }
   }
   ```
   
   After applied HBASE-25873, the result is
   `Total time: 51.990 secs`
   And after applied the patch here, the result is
   `Total time: 32.307 secs`
   
   About 37.8% down of the execution time.


-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to