@Test public void testPerfSingleThread() { final TableName TABLE_NAME = TableName.valueOf("testPerf"); final int NRUNS = 1 * 1000000; // 1M final RegionStates stateMap = new RegionStates(); long st = System.currentTimeMillis(); for (int i = 0; i < NRUNS; ++i) { stateMap.createRegionStateNode(createRegionInfo(TABLE_NAME, i)); } long et = System.currentTimeMillis(); LOG.info(String.format("PERF SingleThread: %s %s/sec", StringUtils.humanTimeDiff(et - st), StringUtils.humanSize(NRUNS / ((et - st) / 1000.0f)))); } }
final TableName TABLE_NAME = TableName.valueOf("testPerf"); final int NRUNS = 1000000; // 1M final RegionStates stateMap = new RegionStates();
@Test public void testRegionDoubleCreation() throws Exception { // NOTE: RegionInfo sort by table first, so we are relying on that final TableName TABLE_NAME_A = TableName.valueOf("testOrderedByTableA"); final TableName TABLE_NAME_B = TableName.valueOf("testOrderedByTableB"); final TableName TABLE_NAME_C = TableName.valueOf("testOrderedByTableC"); final RegionStates stateMap = new RegionStates(); final int NRUNS = 1000; final int NSMALL_RUNS = 3; // add some regions for table B for (int i = 0; i < NRUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_B, i); } // re-add the regions for table B for (int i = 0; i < NRUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_B, i); } waitExecutorService(NRUNS * 2); // add two other tables A and C that will be placed before and after table B (sort order) for (int i = 0; i < NSMALL_RUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_A, i); addRegionNode(stateMap, TABLE_NAME_C, i); } waitExecutorService(NSMALL_RUNS * 2); // check for the list of regions of the 3 tables checkTableRegions(stateMap, TABLE_NAME_A, NSMALL_RUNS); checkTableRegions(stateMap, TABLE_NAME_B, NRUNS); checkTableRegions(stateMap, TABLE_NAME_C, NSMALL_RUNS); }
@Test public void testPerfSingleThread() { final TableName TABLE_NAME = TableName.valueOf("testPerf"); final int NRUNS = 1 * 1000000; // 1M final RegionStates stateMap = new RegionStates(); long st = System.currentTimeMillis(); for (int i = 0; i < NRUNS; ++i) { stateMap.createRegionStateNode(createRegionInfo(TABLE_NAME, i)); } long et = System.currentTimeMillis(); LOG.info(String.format("PERF SingleThread: %s %s/sec", StringUtils.humanTimeDiff(et - st), StringUtils.humanSize(NRUNS / ((et - st) / 1000.0f)))); } }
final TableName TABLE_NAME = TableName.valueOf("testPerf"); final int NRUNS = 1000000; // 1M final RegionStates stateMap = new RegionStates();
@Test public void testRegionDoubleCreation() throws Exception { // NOTE: RegionInfo sort by table first, so we are relying on that final TableName TABLE_NAME_A = TableName.valueOf("testOrderedByTableA"); final TableName TABLE_NAME_B = TableName.valueOf("testOrderedByTableB"); final TableName TABLE_NAME_C = TableName.valueOf("testOrderedByTableC"); final RegionStates stateMap = new RegionStates(); final int NRUNS = 1000; final int NSMALL_RUNS = 3; // add some regions for table B for (int i = 0; i < NRUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_B, i); } // re-add the regions for table B for (int i = 0; i < NRUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_B, i); } waitExecutorService(NRUNS * 2); // add two other tables A and C that will be placed before and after table B (sort order) for (int i = 0; i < NSMALL_RUNS; ++i) { addRegionNode(stateMap, TABLE_NAME_A, i); addRegionNode(stateMap, TABLE_NAME_C, i); } waitExecutorService(NSMALL_RUNS * 2); // check for the list of regions of the 3 tables checkTableRegions(stateMap, TABLE_NAME_A, NSMALL_RUNS); checkTableRegions(stateMap, TABLE_NAME_B, NRUNS); checkTableRegions(stateMap, TABLE_NAME_C, NSMALL_RUNS); }