Skip to content

Commit a1d775b

Browse files
committed
Review from github
1 parent 3f4ba25 commit a1d775b

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
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/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)