/** Stop the running calls then stop the server and client channels. */ @Override @TearDown(Level.Trial) public void teardown() throws Exception { completed.set(true); Thread.sleep(5000); super.teardown(); }
public void runAllBenchmarks() throws IOException { ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("test")); try { List<AbstractBenchmark> benchmarks = createBenchmarks(executor); LOGGER.info("=== Pre-running all benchmarks for JVM warmup ==="); for (AbstractBenchmark benchmark : benchmarks) { benchmark.runBenchmark(); } LOGGER.info("=== Actually running benchmarks for metrics ==="); for (AbstractBenchmark benchmark : benchmarks) { try (OutputStream jsonOut = new FileOutputStream( createOutputFile( String.format( "%s/json/%s.json", outputDirectory, benchmark.getBenchmarkName()))); OutputStream jsonAvgOut = new FileOutputStream( createOutputFile( String.format( "%s/json-avg/%s.json", outputDirectory, benchmark.getBenchmarkName()))); OutputStream csvOut = new FileOutputStream( createOutputFile( String.format( "%s/csv/%s.csv", outputDirectory, benchmark.getBenchmarkName()))); OutputStream odsOut = new FileOutputStream( createOutputFile( String.format( "%s/ods/%s.json", outputDirectory, benchmark.getBenchmarkName())))) { benchmark.runBenchmark( new ForwardingBenchmarkResultWriter( ImmutableList.of( new JsonBenchmarkResultWriter(jsonOut), new JsonAvgBenchmarkResultWriter(jsonAvgOut), new SimpleLineBenchmarkResultWriter(csvOut), new OdsBenchmarkResultWriter( "presto.benchmark." + benchmark.getBenchmarkName(), odsOut)))); } } } finally { executor.shutdownNow(); } }
/** Setup with direct executors, small payloads and the default flow-control window. */ @Setup(Level.Trial) public void setup() throws Exception { super.setup( clientExecutor, ExecutorType.DIRECT, MessageSize.SMALL, responseSize, FlowWindowSize.MEDIUM, ChannelType.NIO, maxConcurrentStreams, channelCount); callCounter = new AtomicLong(); completed = new AtomicBoolean(); startFlowControlledStreamingCalls(maxConcurrentStreams, callCounter, completed, 1); }