예제 #1
0
  private synchronized void exec(
      DataLoadTimeSummary dataLoadTimeSummary,
      DataLoadThreadTime dataLoadThreadTime,
      Scenario scenario)
      throws Exception {
    logger.info("\nLoading " + scenario.getRowCount() + " rows for " + scenario.getTableName());
    long start = System.currentTimeMillis();

    List<Future> writeBatches = getBatches(dataLoadThreadTime, scenario);

    waitForBatches(dataLoadTimeSummary, scenario, start, writeBatches);

    // always update stats for Phoenix base tables
    updatePhoenixStats(scenario.getTableName());
  }
예제 #2
0
 private void waitForBatches(
     DataLoadTimeSummary dataLoadTimeSummary,
     Scenario scenario,
     long start,
     List<Future> writeBatches)
     throws InterruptedException, java.util.concurrent.ExecutionException {
   int sumRows = 0, sumDuration = 0;
   // Wait for all the batch threads to complete
   for (Future<Info> write : writeBatches) {
     Info writeInfo = write.get();
     sumRows += writeInfo.getRowCount();
     sumDuration += writeInfo.getDuration();
     logger.info(
         "Executor ("
             + this.hashCode()
             + ") writes complete with row count ("
             + writeInfo.getRowCount()
             + ") in Ms ("
             + writeInfo.getDuration()
             + ")");
   }
   logger.info(
       "Writes completed with total row count ("
           + sumRows
           + ") with total time of("
           + sumDuration
           + ") Ms");
   dataLoadTimeSummary.add(
       scenario.getTableName(), sumRows, (int) (System.currentTimeMillis() - start));
 }
예제 #3
0
  private List<Future> getBatches(DataLoadThreadTime dataLoadThreadTime, Scenario scenario)
      throws Exception {
    RowCalculator rowCalculator = new RowCalculator(getThreadPoolSize(), scenario.getRowCount());
    List<Future> writeBatches = new ArrayList<>();

    for (int i = 0; i < getThreadPoolSize(); i++) {
      List<Column> phxMetaCols =
          pUtil.getColumnsFromPhoenix(
              scenario.getSchemaName(),
              scenario.getTableNameWithoutSchemaName(),
              pUtil.getConnection());
      int threadRowCount = rowCalculator.getNext();
      logger.info("Kick off thread (#" + i + ")for upsert with (" + threadRowCount + ") rows.");
      Future<Info> write =
          upsertData(
              scenario, phxMetaCols, scenario.getTableName(), threadRowCount, dataLoadThreadTime);
      writeBatches.add(write);
    }
    if (writeBatches.isEmpty()) {
      throw new PherfException(
          "Holy shit snacks! Throwing up hands in disbelief and exiting. Could not write data for some unknown reason.");
    }

    return writeBatches;
  }
예제 #4
0
 public ScenarioResult(Scenario scenario) {
   this.setDataOverride(scenario.getDataOverride());
   this.setPhoenixProperties(scenario.getPhoenixProperties());
   this.setRowCount(scenario.getRowCount());
   this.setTableName(scenario.getTableName());
   this.setName(scenario.getName());
 }