Measures throughput of Java service called from many threads concurrently. It is designed for asynchronous services returning rxJava observables, but also can be used for synchronous services (see example). It generates statistics, histogram, histogram image.
It is built with:
- Java 8,
- Maven,
- rxJava,
- JFreeChart,
- Hist4J (embedded sources).
- action Supplier<Observable<?>> action to be tested. Execution time will be tested. Execution is measured from subscription to completion.
- threads number of threads action will be executed simultaneously.
- testTimeInSeconds total time test will be run.
- histogram should generate histogram? (See example report).
- histogramGraph should generate histogram graph? (See example report).
- printer method to log reports to output. Default log4j
- request rate how many request per second service responds.
- error rate how many errors per second application returns. See rxJava error handling.
- max exec time maximum registered single execution time in ms.
- avg exec time average registered execution time in ms.
mvn install
<dependency>
<groupId>org.marekasf</groupId>
<artifactId>java-throughput-test-runner</artifactId>
<version>0.0.1</version>
<scope>test</scope>
</dependency>
@Test
public void throughputTest()
{
ThroughputRunner.Builder.create()
.action(() -> Observable.just(methodUnderThroughputTest()))
.threads(8)
.testTimeInSeconds(30)
.printer(ThroughputRunner.SYSOUT)
.graph(true)
.histogram(true)
.run();
}
REQUESTS: 23210, ERRORS: 2997751, TOTAL_EXEC_TIME_MS: 544789, TOTAL_LOOP_TIME_MS: 240763, LOOPS: 2979270
request rate : 773.7333333333333 r/s
error rate : 99925.03333333334 e/s
max exec time : 408 ms
avg exec time : 23.47216716932357 ms
avg loop time : 0.07969738146585612 ms
thread rate : 42.6036502205441 r/s
effective req : 1.2922679302175317 ms
Main percentiles (action execution time):
5%: 12.672202 ms
25%: 20.830631 ms
50%: 21.999811 ms
75%: 22.999472 ms
80%: 23.000294 ms
85%: 23.076073 ms
90%: 24.017132 ms
95%: 28.263609 ms
99%: 91.21277 ms