xref: /aosp_15_r20/external/aws-sdk-java-v2/test/sdk-benchmarks/README.md (revision 8a52c7834d808308836a99fc2a6e0ed8db339086)
1*8a52c783SCole Faust# Sdk Benchmark Harness
2*8a52c783SCole Faust
3*8a52c783SCole Faust
4*8a52c783SCole FaustThis module contains sdk benchmark harness using [JMH].
5*8a52c783SCole Faust
6*8a52c783SCole FaustEach benchmark class has a set of default
7*8a52c783SCole FaustJMH configurations tailored to SDK's build job and you might need to
8*8a52c783SCole Faustadjust them based on your test environment such as increasing warmup iterations
9*8a52c783SCole Faustor measurement time in order to get more reliable data.
10*8a52c783SCole Faust
11*8a52c783SCole FaustThere are three ways to run benchmarks.
12*8a52c783SCole Faust
13*8a52c783SCole Faust- Using the executable JAR (Preferred usage per JMH site)
14*8a52c783SCole Faust```bash
15*8a52c783SCole Faustmvn clean install -P quick -pl :sdk-benchmarks --am
16*8a52c783SCole Faust
17*8a52c783SCole Faust# Run specific benchmark
18*8a52c783SCole Faustjava -jar target/benchmarks.jar ApacheHttpClientBenchmark
19*8a52c783SCole Faust
20*8a52c783SCole Faust# Run all benchmarks: 3 warm up iterations, 3 benchmark iterations, 1 fork
21*8a52c783SCole Faustjava -jar target/benchmarks.jar -wi 3 -i 3 -f 1
22*8a52c783SCole Faust```
23*8a52c783SCole Faust
24*8a52c783SCole Faust- Using`mvn exec:exec` commands to invoke `BenchmarkRunner` main method
25*8a52c783SCole Faust```bash
26*8a52c783SCole Faust   mvn clean install -P quick -pl :sdk-benchmarks --am
27*8a52c783SCole Faust   mvn clean install -pl :bom-internal
28*8a52c783SCole Faust   cd test/sdk-benchmarks
29*8a52c783SCole Faust   mvn exec:exec
30*8a52c783SCole Faust```
31*8a52c783SCole Faust
32*8a52c783SCole Faust- From IDE
33*8a52c783SCole Faust
34*8a52c783SCole Faust  You can run the main method within each Benchmark class from your IDE. If you are using Eclipse, you might need to
35*8a52c783SCole Faust  set up build configurations for JMH annotation, please check [JMH]. Note that the benchmark result from IDE
36*8a52c783SCole Faust  might not be as reliable as the above approaches and is generally not recommended.
37*8a52c783SCole Faust
38*8a52c783SCole Faust[JMH]: http://openjdk.java.net/projects/code-tools/jmh/
39