Skip to content

Commit 7d27844

Browse files
committed
Added performance comparison for Apache
1 parent 59ac21f commit 7d27844

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

test/http-client-benchmarks/src/main/java/software/amazon/awssdk/benchmark/UnifiedBenchmarkRunner.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.ArrayList;
2020
import java.util.Collection;
2121
import java.util.List;
22+
import java.util.Map;
2223
import org.openjdk.jmh.results.RunResult;
2324
import org.openjdk.jmh.runner.Runner;
2425
import org.openjdk.jmh.runner.RunnerException;
@@ -208,5 +209,56 @@ private static void printBenchmarkSummary(List<BenchmarkResult> results) {
208209
System.out.println("=".repeat(140));
209210
System.out.printf("Total benchmark results: %d%n", sortedResults.size());
210211
System.out.println("=".repeat(140));
212+
// Print performance comparison in between Apache clients
213+
printApachePerformanceComparison(results);
214+
211215
}
216+
217+
private static void printApachePerformanceComparison(List<BenchmarkResult> results) {
218+
if (results == null || results.isEmpty()) {
219+
return;
220+
}
221+
222+
System.out.println("\nPERFORMANCE COMPARISON (Apache5 vs Apache4):");
223+
System.out.println("=".repeat(80));
224+
225+
Map<String, List<BenchmarkResult>> groupedResults = results.stream()
226+
.filter(r -> r != null && r.getBenchmarkName() != null)
227+
.collect(Collectors.groupingBy(BenchmarkResult::getBenchmarkName));
228+
229+
for (Map.Entry<String, List<BenchmarkResult>> entry : groupedResults.entrySet()) {
230+
String benchmarkName = entry.getKey();
231+
List<BenchmarkResult> benchmarkResults = entry.getValue();
232+
233+
// Find Apache4 baseline
234+
BenchmarkResult apache4 = benchmarkResults.stream()
235+
.filter(r -> r.getClientType() != null && r.getClientType().equals("Apache4"))
236+
.findFirst()
237+
.orElse(null);
238+
239+
if (apache4 == null) {
240+
continue;
241+
}
242+
243+
System.out.printf("\n%s:%n", benchmarkName);
244+
System.out.println("-".repeat(80));
245+
246+
for (BenchmarkResult result : benchmarkResults) {
247+
if (result.getClientType() != null && !result.getClientType().equals("Apache4")) {
248+
double throughputImprovement = ((result.getThroughput() - apache4.getThroughput())
249+
/ apache4.getThroughput()) * 100;
250+
double latencyImprovement = ((apache4.getAvgLatency() - result.getAvgLatency())
251+
/ apache4.getAvgLatency()) * 100;
252+
253+
System.out.printf(" %-20s: %+.1f%% throughput, %+.1f%% latency improvement%n",
254+
result.getClientType(),
255+
throughputImprovement,
256+
latencyImprovement);
257+
}
258+
}
259+
}
260+
261+
System.out.println("\n" + "=".repeat(80));
262+
}
263+
212264
}

test/http-client-benchmarks/src/main/java/software/amazon/awssdk/benchmark/apache4/Apache4Benchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
public class Apache4Benchmark implements CoreBenchmark {
5757
private static final Logger logger = Logger.getLogger(Apache4Benchmark.class.getName());
5858

59-
@Param({"50","200"})
59+
@Param({"50"})
6060
private int maxConnections;
6161

6262
@Param({"10"})

test/http-client-benchmarks/src/main/java/software/amazon/awssdk/benchmark/apache5/Apache5Benchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
public class Apache5Benchmark implements CoreBenchmark {
5757
private static final Logger logger = Logger.getLogger(Apache5Benchmark.class.getName());
5858

59-
@Param({"50","200"})
59+
@Param({"50"})
6060
private int maxConnections;
6161

6262
@Param({"10"})

0 commit comments

Comments
 (0)