use of alluxio.stress.client.ClientIOTaskResult in project alluxio by Alluxio.
the class StressClientIOBenchIntegrationTest 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 StressClientIOBench().run(new String[] { "--in-process", "--base", sLocalAlluxioClusterResource.get().getMasterURI() + "/client/", "--operation", "Write", "--threads", "2", "--file-size", "1m", "--buffer-size", "128k", "--warmup", "0s", "--duration", "1s", "--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++) {
ClientIOTaskResult summary = (ClientIOTaskResult) 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.getThreadCountResults().isEmpty());
for (ClientIOTaskResult.ThreadCountResult threadResult : summary.getThreadCountResults().values()) {
assertTrue(threadResult.getErrors().isEmpty());
}
}
// reset the output to the console
System.setOut(originalOut);
}
use of alluxio.stress.client.ClientIOTaskResult in project alluxio by Alluxio.
the class StressClientIOBench method runLocal.
@Override
@SuppressFBWarnings("BC_UNCONFIRMED_CAST")
public ClientIOTaskResult runLocal() throws Exception {
List<Integer> threadCounts = new ArrayList<>(mParameters.mThreads);
threadCounts.sort(Comparator.comparingInt(i -> i));
ClientIOTaskResult taskResult = new ClientIOTaskResult();
taskResult.setBaseParameters(mBaseParameters);
taskResult.setParameters(mParameters);
for (Integer numThreads : threadCounts) {
ClientIOTaskResult.ThreadCountResult threadCountResult = runForThreadCount(numThreads);
if (!mBaseParameters.mProfileAgent.isEmpty()) {
taskResult.putTimeToFirstBytePerThread(numThreads, addAdditionalResult(threadCountResult.getRecordStartMs(), threadCountResult.getEndMs()));
}
taskResult.addThreadCountResults(numThreads, threadCountResult);
}
return taskResult;
}
use of alluxio.stress.client.ClientIOTaskResult in project alluxio by Alluxio.
the class StressClientIOBenchIntegrationTest method validateTheResultWithWriteType.
private void validateTheResultWithWriteType(String writeType) throws Exception {
String output = new StressClientIOBench().run(new String[] { "--in-process", "--start-ms", Long.toString(System.currentTimeMillis() + 5000), "--base", sLocalAlluxioClusterResource.get().getMasterURI() + "/client/", "--operation", "Write", "--threads", "2", "--file-size", "1m", "--buffer-size", "128k", "--warmup", "0s", "--duration", "1s", "--write-type", writeType });
// convert the result into summary, and check whether it have errors.
ClientIOTaskResult summary = (ClientIOTaskResult) JsonSerializable.fromJson(output);
assertFalse(summary.getThreadCountResults().isEmpty());
for (ClientIOTaskResult.ThreadCountResult threadResult : summary.getThreadCountResults().values()) {
assertTrue(threadResult.getErrors().isEmpty());
}
}
Aggregations