Search in sources :

Example 1 with StressMasterBench

use of alluxio.stress.cli.StressMasterBench in project alluxio by Alluxio.

the class StressMasterBenchIntegrationTest method validateTheResultWithWriteType.

private void validateTheResultWithWriteType(String writeType) throws Exception {
    String output1 = new StressMasterBench().run(new String[] { "--in-process", "--base", sLocalAlluxioClusterResource.get().getMasterURI() + "/", "--operation", "CreateFile", "--fixed-count", "20", "--target-throughput", "300", "--threads", "5", "--warmup", "0s", "--duration", "3s", "--write-type", writeType });
    String output2 = new StressMasterBench().run(new String[] { "--in-process", "--base", sLocalAlluxioClusterResource.get().getMasterURI() + "/", "--operation", "DeleteFile", "--fixed-count", "20", "--target-throughput", "100", "--threads", "5", "--warmup", "0s", "--duration", "1s", "--write-type", writeType });
    // convert the result into summary, and check whether it have errors.
    MasterBenchSummary summary1 = (MasterBenchSummary) JsonSerializable.fromJson(output1);
    MasterBenchSummary summary2 = (MasterBenchSummary) JsonSerializable.fromJson(output2);
    // confirm that the results contain information, and they don't contain errors.
    assertFalse(summary1.getNodeResults().isEmpty());
    assertTrue(summary1.collectErrorsFromAllNodes().isEmpty());
    assertFalse(summary2.getNodeResults().isEmpty());
    assertTrue(summary2.collectErrorsFromAllNodes().isEmpty());
}
Also used : StressMasterBench(alluxio.stress.cli.StressMasterBench) MasterBenchSummary(alluxio.stress.master.MasterBenchSummary)

Example 2 with StressMasterBench

use of alluxio.stress.cli.StressMasterBench in project alluxio by Alluxio.

the class StressMasterBenchIntegrationTest method validateTheOutput.

private void validateTheOutput(String operation) throws Exception {
    long startTime = System.currentTimeMillis();
    String basePath = sLocalAlluxioClusterResource.get().getMasterURI() + "/";
    String output = new StressMasterBench().run(new String[] { "--in-process", "--base", basePath, "--operation", operation, "--stop-count", "100", "--target-throughput", "1000", "--threads", "5", "--warmup", "0s", "--duration", "10s" });
    MasterBenchSummary summary = (MasterBenchSummary) JsonSerializable.fromJson(output);
    assertEquals(summary.getParameters().mOperation.toString(), operation);
    assertEquals(summary.getParameters().mBasePath, basePath);
    assertEquals(summary.getParameters().mStopCount, 100);
    assertEquals(summary.getParameters().mTargetThroughput, 1000);
    assertEquals(summary.getParameters().mThreads, 5);
    assertEquals(summary.getParameters().mWarmup, "0s");
    assertEquals(summary.getParameters().mDuration, "10s");
    assertTrue(summary.getEndTimeMs() > startTime);
    assertTrue(summary.getNodeResults().size() >= 1);
    assertTrue(summary.getDurationMs() > 0);
    assertTrue(summary.getThroughput() > 0);
    assertEquals(summary.getStatistics().mNumSuccess, 100);
    assertTrue(summary.collectErrorsFromAllNodes().isEmpty());
}
Also used : StressMasterBench(alluxio.stress.cli.StressMasterBench) MasterBenchSummary(alluxio.stress.master.MasterBenchSummary)

Example 3 with StressMasterBench

use of alluxio.stress.cli.StressMasterBench in project alluxio by Alluxio.

the class StressMasterBenchIntegrationTest method writeTypeALLTaskTest.

@Test
public void writeTypeALLTaskTest() throws Exception {
    // redirect the output stream
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    PrintStream originalOut = System.out;
    System.setOut(new PrintStream(out));
    new StressMasterBench().run(new String[] { "--in-process", "--base", sLocalAlluxioClusterResource.get().getMasterURI() + "/", "--operation", "CreateFile", "--fixed-count", "20", "--target-throughput", "300", "--threads", "5", "--warmup", "0s", "--duration", "3s", "--write-type", "ALL" });
    String printOutResult = out.toString();
    List<String> resultList = getJsonResult(printOutResult);
    assertEquals(resultList.size(), 4);
    // the possible write types
    List<String> writeTypes = ImmutableList.of("MUST_CACHE", "CACHE_THROUGH", "ASYNC_THROUGH", "THROUGH");
    for (int i = 0; i < resultList.size(); i++) {
        MasterBenchSummary summary = (MasterBenchSummary) JsonSerializable.fromJson(resultList.get(i));
        // confirm that the task was executed with certain write type and output no errors
        assertEquals(summary.getParameters().mWriteType, writeTypes.get(i));
        assertFalse(summary.getNodeResults().isEmpty());
        assertTrue(summary.collectErrorsFromAllNodes().isEmpty());
    }
    // reset the output to the console
    System.setOut(originalOut);
}
Also used : PrintStream(java.io.PrintStream) StressMasterBench(alluxio.stress.cli.StressMasterBench) MasterBenchSummary(alluxio.stress.master.MasterBenchSummary) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 4 with StressMasterBench

use of alluxio.stress.cli.StressMasterBench in project alluxio by Alluxio.

the class MaxThroughput method createFiles.

/**
 * @param numFiles number of files to create with each task
 * @param args the args
 */
private void createFiles(long numFiles, List<String> args) throws Exception {
    List<String> newArgs = new ArrayList<>(args);
    updateArgValue(newArgs, "--operation", Operation.CREATE_FILE.toString());
    updateArgValue(newArgs, "--warmup", "0s");
    updateArgValue(newArgs, "--threads", "128");
    updateArgValue(newArgs, "--stop-count", Long.toString(numFiles));
    updateArgValue(newArgs, "--target-throughput", "10000");
    LOG.info(String.format("Preparing %d files. args: %s", numFiles, String.join(" ", newArgs)));
    Benchmark b = new StressMasterBench();
    String result = b.run(newArgs.toArray(new String[0]));
    MasterBenchSummary summary = JsonSerializable.fromJson(result, new MasterBenchSummary[0]);
    if (!summary.collectErrorsFromAllNodes().isEmpty()) {
        throw new IllegalStateException(String.format("Could not create files for operation (%s). error: %s", mParameters.mOperation, summary.collectErrorsFromAllNodes().iterator().next()));
    }
}
Also used : StressMasterBench(alluxio.stress.cli.StressMasterBench) ArrayList(java.util.ArrayList) Benchmark(alluxio.stress.cli.Benchmark) MasterBenchSummary(alluxio.stress.master.MasterBenchSummary)

Example 5 with StressMasterBench

use of alluxio.stress.cli.StressMasterBench in project alluxio by Alluxio.

the class MaxThroughput method runSingleTest.

/**
 * @param requiredCount the number of operations that may happen for a successful run
 * @param args the args
 * @return the results
 */
private MasterBenchSummary runSingleTest(long requiredCount, List<String> args) throws Exception {
    prepareBeforeSingleTest(requiredCount, args);
    Benchmark b = new StressMasterBench();
    String result = b.run(args.toArray(new String[0]));
    return JsonSerializable.fromJson(result, new MasterBenchSummary[0]);
}
Also used : StressMasterBench(alluxio.stress.cli.StressMasterBench) Benchmark(alluxio.stress.cli.Benchmark)

Aggregations

StressMasterBench (alluxio.stress.cli.StressMasterBench)8 MasterBenchSummary (alluxio.stress.master.MasterBenchSummary)4 Test (org.junit.Test)4 Benchmark (alluxio.stress.cli.Benchmark)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 ArrayList (java.util.ArrayList)1