Update S3 e2e benchmark for accurate throughput measurement (#4682)
Motivation and Context
The S3 e2e benchmark was compared to other SDKs’ counterparts with concurrency size 64. The Rust SDK reported ~1.6 Gbps for uploads and ~1.9 Gbps for downloads, which seemed low compared to
smithy-javareporting 10.3 Gbps for uploads and 10.2 Gbps for downloads.NETreporting 6.9 Gbps for uploads and 8.9 Gbps for downloads.Description
Rust SDK showed sub-optimal throughput due to two issues in the benchmark harness:
- Input creation included in timing —
data.to_vec()(256KiB × 10,000 = 2.5GB of copies) and request construction happened inside the measured region.- Single-threaded execution —
join_allwithouttokio::spawnmeant all 10,000 futures were polled on a single thread, not utilizing the multi-threaded tokio runtime.To address these, this PR
- Moves request construction outside timing: Pre-build all request futures before
Instant::now(), so only actual useful work is measured, e.g. serde, network I/O.- Uses
tokio::spawnper operation.- Shares upload body via Bytes: Instead of cloning 256KiB per request (
data.to_vec()), create one Bytes instance and let it be shared by operations. Reduces upload memory from ~2.9GB to ~340MB.- Returns
Durationfromrun_batch: Timing is captured inside the function to precisely bracket only the network execution phase.Testing
The analysis doc is to be updated for varying concurrency sizes but here are the updated results for S3 e2e benchmark with concurrency size 64.
Before: | SDK / Configuration | PutObject Gbps | PutObject p50 | PutObject Mem peak | GetObject Gbps | GetObject p50 | GetObject Mem peak | |—|—|—|—|—|—|—| | Rust @ 64 conc | 1.63 | — | 2916 MB | 1.90 | — | 316 MB |
After: | SDK / Configuration | PutObject Gbps | PutObject p50 | PutObject Mem peak | GetObject Gbps | GetObject p50 | GetObject Mem peak | |—|—|—|—|—|—|—| | Rust @ 64 conc | 10.5 | — | 340 MB | 10.3 | — | 290 MB |
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Smithy Rust
Smithy code generators for Rust that generate clients, servers, and the entire AWS SDK. The latest unreleased SDK build can be found in aws-sdk-rust/next.
Design documentation
All internal and external interfaces are considered unstable and subject to change without notice.
Setup
./gradlewwill setup gradle for you. JDK 17 is required.Development
For development, pre-commit hooks make it easier to pass automated linting when opening a pull request. Setup:
Project Layout
aws: AWS specific codegen & Rust code (signing, endpoints, customizations, etc.) Common commands:./gradlew :aws:sdk:assemble: Generate (but do not test / compile etc.) a fresh SDK intosdk/build/aws-sdk./gradlew :aws:sdk:sdkTest: Generate & run all tests for a fresh SDK. (Note that these tests require Go to be installed for FIP support to compile properly)./gradlew :aws:sdk:{cargoCheck, cargoTest, cargoDocs, cargoClippy}: Generate & run specified cargo command.codegen-core: Common code generation logic useful for clients and serverscodegen-client: Smithy client code generationcodegen-client-test: Smithy protocol test generation & integration tests for Smithy client whitelabel codedesign: Design documentation. See the design/README.md for details about building / viewing.codegen-server: Smithy server code generationcodegen-server-test: Smithy protocol test generation & integration tests for Smithy server whitelabel codeexamples: A collection of server implementation examplesTesting
Running all of smithy-rs’s tests can take a very long time, so it’s better to know which parts to test based on the changes being made, and allow continuous integration to find other issues when posting a pull request.
In general, the components of smithy-rs affect each other in the following order (with earlier affecting later):
rust-runtimecodegenandcodegen-serveraws/rust-runtimeaws/codegen-aws-sdkSome components, such as
codegen-client-testandcodegen-server-test, are purely for testing other components.Testing
rust-runtimeandaws/rust-runtimeTo test the
rust-runtimecrates:To test the
aws/rust-runtimecrates:Some runtime crates have a
additional-ciscript that can also be run. These scripts often requirecargo-hackandcargo-udepsto be installed.Testing Client/Server Codegen
To test the code generation, the following can be used:
Several Kotlin unit tests generate Rust projects and compile them. When these fail, they typically output links to the location of the generated code so that it can be inspected.
To look at generated code when the codegen tests fail, check these paths depending on the test suite that’s failing:
codegen-client-test/build/smithyprojections/codegen-client-testcodegen-server-test/build/smithyprojections/codegen-server-testTesting SDK Codegen
See the readme in
aws/sdk/for more information about these targets as they can be configured to generate more or less AWS service clients.The generated SDK will be placed in
aws/sdk/build/aws-sdk.MSRV Policy
The MSRV (Minimum Supported Rust Version) for the crates in this project is
stable-2, i.e. the currentstableRust version and the prior two versions. Older versions may work. In rare circumstances our MSRV may exceedstable-2for security purposes (ex: to update a dependency for a security fix that requires an MSRV bump).