-
Notifications
You must be signed in to change notification settings - Fork 912
S3 Benchmarks - support java-based multipart client #4288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
bc80de0
Implement multipart upload in Java-based S3 async client (#4052)
zoewangg 910b30f
Iterate SdkFields to convert requests (#4177)
zoewangg d998908
Fix null content length in SplittingPublisher (#4173)
zoewangg afe5f58
Implement multipart copy in Java-based S3 async client (#4189)
zoewangg 35e6e4e
Create split method in AsyncRequestBody to return SplittingPublisher …
zoewangg 8472539
Merge remote-tracking branch 'origin' into feature/master/s3multipart
zoewangg e0b4bfc
Add more tests with ByteArrayAsyncRequestBody (#4214)
zoewangg 11c6362
Handle null response metadata (#4215)
zoewangg 3e6e70f
Support streaming with unknown content length (#4226)
zoewangg 2e0a841
Multipart API
L-Applin 19efa8b
getObject(...) throw UnsupportedOperationException
L-Applin 2667219
Use user agent for all requests in MultipartS3Client
L-Applin bcbbf98
MultipartS3AsyncClient javadoc + API_NAME private
L-Applin 7e82f38
use `maximumMemoryUsageInBytes`
L-Applin f197c2e
fix problem with UserAgent, cleanup
L-Applin d255b1f
Create a configuration class for SdkPublisher#split (#4236)
zoewangg 915099b
add support for JavaBasedS3Client
L-Applin e0b980b
Java based upload
L-Applin 80b9530
Java copy benchmark
L-Applin 242d818
Jav based - add apiCallBufferSizeInBytes config from readBufferSizeInMb
L-Applin 992f9c2
Jav based - checksumAlgo
L-Applin 675aa0d
fix copy benchmark
zoewangg d91b04a
add support for connection acquire timeout
L-Applin cca1870
add support for connection acquire timeout
L-Applin 8e63285
allow to force crt http client
L-Applin 98f7974
allow to force crt http client
L-Applin 2c938c7
fix crt http config
L-Applin 65cc9df
S3 Multipart API implementation (#4235)
L-Applin 32ddd19
Merge remote-tracking branch 'origin/master' into feature/master/s3mu…
zoewangg 28c126d
Fix test
zoewangg 85a1fd7
Guard against re-subscription in SplittingPublisher (#4253)
L-Applin 466e687
Fix a race condition where the third upload part request was sent bef…
zoewangg 43eca15
maxConcurrency for Javabased with crt http client
L-Applin 8794014
Merge branch 'feature/master/s3multipart' of github.com:aws/aws-sdk-j…
L-Applin edd79c7
fix merge
L-Applin ef8d290
allow maxConcurrency config with TM and Netty
L-Applin 5ba46a7
Merge branch 'master' of github.com:aws/aws-sdk-java-v2 into olapplin…
L-Applin 1e839e7
cleanup
L-Applin 8db6262
fix checkstyle
L-Applin 53ea643
pr comment
L-Applin dd72b7f
added version and operation cli arg to README
L-Applin 589fee8
Merge branch 'master' into olapplin/s3-multi-perf-2
L-Applin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
head -c 1B </dev/urandom >/dev/shm/1B | ||
head -c 8388607B </dev/urandom >/dev/shm/8MB-1 | ||
head -c 8388609B </dev/urandom >/dev/shm/8MB+1 | ||
head -c 128M </dev/urandom >/dev/shm/128MB | ||
head -c 4B </dev/urandom >/dev/shm/4GB | ||
head -c 30GB </dev/urandom >/dev/shm/30GB | ||
|
||
head -c 1B </dev/urandom >/1B | ||
head -c 8388607B </dev/urandom >/8MB-1 | ||
head -c 8388609B </dev/urandom >/8MB+1 | ||
head -c 128M </dev/urandom >/128MB | ||
head -c 4B </dev/urandom >/4GB | ||
head -c 30GB </dev/urandom >/30GB | ||
head -c 1 </dev/urandom >/dev/shm/1B | ||
head -c $((8*1024*1024-1)) </dev/urandom >/dev/shm/8MB-1 | ||
head -c $((8*1024*1024+1)) </dev/urandom >/dev/shm/8MB+1 | ||
head -c $((128*1024*1024)) </dev/urandom >/dev/shm/128MB | ||
head -c $((4*1024*1024*1024)) </dev/urandom >/dev/shm/4GB | ||
head -c $((30*1024*1024*1024)) </dev/urandom >/dev/shm/30GB | ||
|
||
head -c 1 </dev/urandom >/1B | ||
head -c $((8*1024*1024-1)) </dev/urandom >/8MB-1 | ||
head -c $((8*1024*1024+1)) </dev/urandom >/8MB+1 | ||
head -c $((128*1024*1024)) </dev/urandom >/128MB | ||
head -c $((4*1024*1024*1024)) </dev/urandom >/4GB | ||
head -c $((30*1024*1024*1024)) </dev/urandom >/30GB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
...nchmarks/src/main/java/software/amazon/awssdk/s3benchmarks/BaseJavaS3ClientBenchmark.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.awssdk.s3benchmarks; | ||
|
||
import static software.amazon.awssdk.s3benchmarks.BenchmarkUtils.BENCHMARK_ITERATIONS; | ||
import static software.amazon.awssdk.s3benchmarks.BenchmarkUtils.DEFAULT_TIMEOUT; | ||
import static software.amazon.awssdk.s3benchmarks.BenchmarkUtils.printOutResult; | ||
import static software.amazon.awssdk.transfer.s3.SizeConstant.MB; | ||
|
||
import java.time.Duration; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import software.amazon.awssdk.http.async.SdkAsyncHttpClient; | ||
import software.amazon.awssdk.http.crt.AwsCrtAsyncHttpClient; | ||
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient; | ||
import software.amazon.awssdk.services.s3.S3AsyncClient; | ||
import software.amazon.awssdk.services.s3.S3Client; | ||
import software.amazon.awssdk.services.s3.model.ChecksumAlgorithm; | ||
import software.amazon.awssdk.utils.Logger; | ||
import software.amazon.awssdk.utils.Validate; | ||
|
||
public abstract class BaseJavaS3ClientBenchmark implements TransferManagerBenchmark { | ||
private static final Logger logger = Logger.loggerFor(BaseJavaS3ClientBenchmark.class); | ||
|
||
protected final S3Client s3Client; | ||
|
||
protected final S3AsyncClient s3AsyncClient; | ||
protected final String bucket; | ||
protected final String key; | ||
protected final Duration timeout; | ||
private final ChecksumAlgorithm checksumAlgorithm; | ||
private final int iteration; | ||
|
||
protected BaseJavaS3ClientBenchmark(TransferManagerBenchmarkConfig config) { | ||
this.bucket = Validate.paramNotNull(config.bucket(), "bucket"); | ||
this.key = Validate.paramNotNull(config.key(), "key"); | ||
this.timeout = Validate.getOrDefault(config.timeout(), () -> DEFAULT_TIMEOUT); | ||
this.iteration = Validate.getOrDefault(config.iteration(), () -> BENCHMARK_ITERATIONS); | ||
this.checksumAlgorithm = config.checksumAlgorithm(); | ||
|
||
this.s3Client = S3Client.create(); | ||
|
||
long partSizeInMb = Validate.paramNotNull(config.partSizeInMb(), "partSize"); | ||
long readBufferInMb = Validate.paramNotNull(config.readBufferSizeInMb(), "readBufferSizeInMb"); | ||
Validate.mutuallyExclusive("cannot use forceCrtHttpClient and connectionAcquisitionTimeoutInSec", | ||
config.forceCrtHttpClient(), config.connectionAcquisitionTimeoutInSec()); | ||
this.s3AsyncClient = S3AsyncClient.builder() | ||
.multipartEnabled(true) | ||
.multipartConfiguration(c -> c.minimumPartSizeInBytes(partSizeInMb * MB) | ||
.thresholdInBytes(partSizeInMb * 2 * MB) | ||
.apiCallBufferSizeInBytes(readBufferInMb * MB)) | ||
.httpClientBuilder(httpClient(config)) | ||
.build(); | ||
} | ||
|
||
private SdkAsyncHttpClient.Builder httpClient(TransferManagerBenchmarkConfig config) { | ||
if (config.forceCrtHttpClient()) { | ||
logger.info(() -> "Using CRT HTTP client"); | ||
AwsCrtAsyncHttpClient.Builder builder = AwsCrtAsyncHttpClient.builder(); | ||
if (config.readBufferSizeInMb() != null) { | ||
builder.readBufferSizeInBytes(config.readBufferSizeInMb() * MB); | ||
} | ||
if (config.maxConcurrency() != null) { | ||
builder.maxConcurrency(config.maxConcurrency()); | ||
} | ||
return builder; | ||
} | ||
NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder(); | ||
if (config.connectionAcquisitionTimeoutInSec() != null) { | ||
Duration connAcqTimeout = Duration.ofSeconds(config.connectionAcquisitionTimeoutInSec()); | ||
builder.connectionAcquisitionTimeout(connAcqTimeout); | ||
} | ||
if (config.maxConcurrency() != null) { | ||
builder.maxConcurrency(config.maxConcurrency()); | ||
} | ||
return builder; | ||
} | ||
|
||
protected abstract void sendOneRequest(List<Double> latencies) throws Exception; | ||
|
||
protected abstract long contentLength() throws Exception; | ||
|
||
@Override | ||
public void run() { | ||
try { | ||
warmUp(); | ||
doRunBenchmark(); | ||
millems marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} catch (Exception e) { | ||
logger.error(() -> "Exception occurred", e); | ||
} finally { | ||
cleanup(); | ||
} | ||
} | ||
|
||
private void cleanup() { | ||
s3Client.close(); | ||
s3AsyncClient.close(); | ||
} | ||
|
||
private void warmUp() throws Exception { | ||
logger.info(() -> "Starting to warm up"); | ||
for (int i = 0; i < 3; i++) { | ||
sendOneRequest(new ArrayList<>()); | ||
millems marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Thread.sleep(500); | ||
millems marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
logger.info(() -> "Ending warm up"); | ||
} | ||
|
||
private void doRunBenchmark() throws Exception { | ||
List<Double> metrics = new ArrayList<>(); | ||
for (int i = 0; i < iteration; i++) { | ||
sendOneRequest(metrics); | ||
} | ||
printOutResult(metrics, "S3 Async client", contentLength()); | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.