Skip to content

Commit 4833db9

Browse files
committed
Review from github
1 parent 3f4ba25 commit 4833db9

File tree

4 files changed

+27
-80
lines changed

4 files changed

+27
-80
lines changed

test/http-client-benchmarks/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
<plugin>
115115
<groupId>org.apache.maven.plugins</groupId>
116116
<artifactId>maven-compiler-plugin</artifactId>
117-
<version>3.1</version>
117+
<version>3.11.0</version>
118118
<!-- Override the configuration in the parent-->
119119
<configuration combine.self="override">
120120
<compilerVersion>${javac.target}</compilerVersion>

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

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
package software.amazon.awssdk.benchmark;
1717

1818

19+
import java.util.ArrayList;
20+
import java.util.Collection;
21+
import java.util.List;
1922
import org.openjdk.jmh.results.RunResult;
2023
import org.openjdk.jmh.runner.Runner;
2124
import org.openjdk.jmh.runner.RunnerException;
@@ -29,7 +32,6 @@
2932
import software.amazon.awssdk.regions.Region;
3033

3134
import java.time.Instant;
32-
import java.util.*;
3335
import java.util.logging.Logger;
3436
import java.util.stream.Collectors;
3537

@@ -72,10 +74,6 @@ public static void main(String[] args) throws Exception {
7274
for (BenchmarkResult result : allResults) {
7375
publisher.publishBenchmarkResult(result, runId);
7476
}
75-
76-
// Print comparison report
77-
printComparisonReport(allResults);
78-
7977
logger.info("\nBenchmark complete! CloudWatch metrics published with run ID: " + runId);
8078

8179
} finally {
@@ -133,61 +131,4 @@ private static BenchmarkResult convertToBenchmarkResult(String clientType,
133131
threadCount
134132
);
135133
}
136-
137-
private static void printComparisonReport(List<BenchmarkResult> results) {
138-
System.out.println("\n" + "=".repeat(80));
139-
System.out.println("PERFORMANCE COMPARISON REPORT");
140-
System.out.println("=".repeat(80) + "\n");
141-
142-
// Group results by client type
143-
Map<String, Map<String, BenchmarkResult>> grouped = results.stream()
144-
.collect(Collectors.groupingBy(
145-
BenchmarkResult::getClientType,
146-
Collectors.toMap(
147-
BenchmarkResult::getBenchmarkName,
148-
r -> r
149-
)
150-
));
151-
152-
// Print the structure we actually have , to view it on console
153-
System.out.println("Available results structure:");
154-
for (Map.Entry<String, Map<String, BenchmarkResult>> entry : grouped.entrySet()) {
155-
System.out.println("Client: " + entry.getKey());
156-
for (String benchmarkName : entry.getValue().keySet()) {
157-
System.out.println(" - " + benchmarkName);
158-
}
159-
}
160-
System.out.println();
161-
162-
// Get all unique benchmark names across all clients
163-
Set<String> allBenchmarkNames = grouped.values().stream()
164-
.flatMap(map -> map.keySet().stream())
165-
.collect(Collectors.toSet());
166-
167-
// Print results table with dynamic columns
168-
System.out.printf("%-20s", "Client Type");
169-
for (String benchmarkName : allBenchmarkNames) {
170-
System.out.printf(" %-15s", benchmarkName);
171-
}
172-
System.out.println();
173-
System.out.println("-".repeat(20 + (allBenchmarkNames.size() * 16)));
174-
175-
for (String clientType : Arrays.asList("Apache4", "Apache5-Platform", "Apache5-Virtual")) {
176-
Map<String, BenchmarkResult> clientResults = grouped.get(clientType);
177-
if (clientResults != null) {
178-
System.out.printf("%-20s", clientType);
179-
for (String benchmarkName : allBenchmarkNames) {
180-
BenchmarkResult result = clientResults.get(benchmarkName);
181-
if (result != null) {
182-
System.out.printf(" %-15.2f", result.getThroughput());
183-
} else {
184-
System.out.printf(" %-15s", "N/A");
185-
}
186-
}
187-
System.out.println();
188-
}
189-
}
190-
191-
}
192-
193134
}

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.openjdk.jmh.annotations.Warmup;
3636
import org.openjdk.jmh.infra.Blackhole;
3737
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
38+
import software.amazon.awssdk.benchmark.core.CoreBenchmark;
3839
import software.amazon.awssdk.benchmark.core.S3BenchmarkImpl;
3940
import software.amazon.awssdk.http.SdkHttpClient;
4041
import software.amazon.awssdk.http.apache5.Apache5HttpClient;
@@ -47,12 +48,12 @@
4748
import java.util.logging.Logger;
4849

4950
@BenchmarkMode(Mode.Throughput)
50-
@OutputTimeUnit(TimeUnit.MILLISECONDS)
51+
@OutputTimeUnit(TimeUnit.SECONDS)
5152
@State(Scope.Benchmark)
5253
@Fork(value = 1, jvmArgs = {"-Xms2G", "-Xmx2G", "--enable-preview"})
5354
@Warmup(iterations = 3, time = 15, timeUnit = TimeUnit.SECONDS)
5455
@Measurement(iterations = 5, time = 10, timeUnit = TimeUnit.SECONDS)
55-
public class Apache5Benchmark {
56+
public class Apache5Benchmark implements CoreBenchmark {
5657
private static final Logger logger = Logger.getLogger(Apache5Benchmark.class.getName());
5758

5859
@Param({"50","200"})
@@ -112,16 +113,19 @@ public void setup() {
112113
}
113114

114115
@Benchmark
116+
@Override
115117
public void simpleGet(Blackhole blackhole) throws Exception {
116118
benchmark.executeGet("medium", blackhole);
117119
}
118120

119121
@Benchmark
122+
@Override
120123
public void simplePut(Blackhole blackhole) throws Exception {
121124
benchmark.executePut("medium", blackhole);
122125
}
123126

124127
@Benchmark
128+
@Override
125129
public void multiThreadedGet(Blackhole blackhole) throws Exception {
126130
List<Future<?>> futures = new ArrayList<>(threadCount);
127131

@@ -142,6 +146,7 @@ public void multiThreadedGet(Blackhole blackhole) throws Exception {
142146
}
143147

144148
@Benchmark
149+
@Override
145150
public void multiThreadedPut(Blackhole blackhole) throws Exception {
146151
List<Future<?>> futures = new ArrayList<>(threadCount);
147152

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

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,25 +121,26 @@ public void executePut(String size, Blackhole blackhole) {
121121

122122
public void cleanup() {
123123
try {
124-
// Delete all objects
125-
ListObjectsV2Response listResponse = s3Client.listObjectsV2(
126-
ListObjectsV2Request.builder()
127-
.bucket(bucketName)
128-
.build()
129-
);
130-
131-
for (S3Object object : listResponse.contents()) {
132-
s3Client.deleteObject(DeleteObjectRequest.builder()
133-
.bucket(bucketName)
134-
.key(object.key())
135-
.build());
136-
}
137-
124+
// Delete all objects (handle pagination)
125+
ListObjectsV2Request.Builder listRequestBuilder = ListObjectsV2Request.builder();
126+
String continuationToken = null;
127+
do {
128+
if (continuationToken != null) {
129+
listRequestBuilder.continuationToken(continuationToken);
130+
}
131+
ListObjectsV2Response listResponse = s3Client.listObjectsV2(listRequestBuilder.build());
132+
for (S3Object object : listResponse.contents()) {
133+
s3Client.deleteObject(DeleteObjectRequest.builder()
134+
.bucket(bucketName)
135+
.key(object.key())
136+
.build());
137+
}
138+
continuationToken = listResponse.nextContinuationToken();
139+
} while (continuationToken != null);
138140
// Delete bucket
139141
s3Client.deleteBucket(DeleteBucketRequest.builder()
140142
.bucket(bucketName)
141143
.build());
142-
143144
logger.info("Cleaned up bucket: " + bucketName);
144145

145146
} catch (Exception e) {

0 commit comments

Comments
 (0)