Skip to content

perf(storage): add write_object upload strategies benchmarking suite - #6611

Open
xlai20 wants to merge 12 commits into
googleapis:mainfrom
xlai20:write-object-benchmarking
Open

perf(storage): add write_object upload strategies benchmarking suite#6611
xlai20 wants to merge 12 commits into
googleapis:mainfrom
xlai20:write-object-benchmarking

Conversation

@xlai20

@xlai20 xlai20 commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary

Adds an independent benchmarking suite crate storage-benchmark-write-object under src/storage/benchmarks/write_object to evaluate and compare different upload strategies and checksum validation mechanisms for write_object.

This benchmarking suite provides empirical performance and throughput data across various payload sizes to inform the decision on the default write_object behavior for seekable sources (e.g., local files).

Scenarios Evaluated

  1. Option A (Option_A_Unbuffered_Baseline):
    • .send_unbuffered()
    • Single continuous HTTP stream; 0 application heap buffer.
    • Checksum computed on the fly and validated client-side upon upload completion.
  2. Option B (Option_B_Unbuffered_2Pass):
    • .precompute_checksums().await?.send_unbuffered()
    • Pass 1: Fast local disk scan to compute SIMD CRC32C checksum (populates page cache).
    • Pass 2: Single continuous HTTP PUT stream with x-goog-hash server-side validation header.
    • 0 application heap buffer.
  3. Option C (Option_C_Buffered_Chunked):
    • .send_buffered()
    • 1-pass chunked upload using sequential 8 MiB HTTP PUT requests.
    • Server-side validation enforced by attaching checksum to the final chunk.
    • Requires 8 MiB in-memory buffer per upload.

Benchmark Features

  • 5 Object Size Tiers: 12 MiB (single-shot multipart), 64 MiB (small resumable / 8 chunks), 512 MiB (medium resumable / 64 chunks), 2 GiB (large resumable / 256 chunks), and 8 GiB (stress resumable / 1,024 chunks).
  • Pre-flight Warmup (512 KiB): Executes a one-time global warmup per process to verify authentication, check bucket permissions, and prime the TLS 1.3 connection pool before running measured iterations.
  • Physical Disk & Page Cache Control: Generates non-compressible pseudo-random files on physical storage and invokes libc::posix_fadvise(DONTNEED) before every iteration to ensure realistic, cold disk reads.
  • Reporting & Orchestration:
    • Real-time terminal summary tables (Mean, P50, P90, P99 latency, and throughput in MiB/s).
    • Optional raw CSV latency and JSON summary persistence via GOOGLE_CLOUD_RUST_BENCHMARKS_STATS_OUTPUT_PATH.
    • run_all.sh driver script to run all 5 tiers sequentially.

Testing

  • Unit tests added for CLI parsing and statistical metric calculations.
  • Verified workspace compilation, cargo clippy --all-targets -- -D warnings, and cargo fmt.
  • Executed full 5-tier benchmark runs on physical SSD storage against live GCS multi-region buckets.

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Sep 1, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new benchmark suite, storage-benchmark-write-object, to compare GCS write_object upload strategies and checksum modes. Feedback on the implementation highlights two style guide violations in source.rs: the use of blocking std::fs::create_dir_all within an asynchronous function, and the absence of required // SAFETY: comments on unsafe blocks.

Comment thread src/storage/benchmarks/write_object/src/source.rs Outdated
Comment thread src/storage/benchmarks/write_object/src/source.rs
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.53%. Comparing base (25c2bdf) to head (27459d0).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6611   +/-   ##
=======================================
  Coverage   96.53%   96.53%           
=======================================
  Files         306      306           
  Lines       93503    93503           
=======================================
+ Hits        90263    90267    +4     
+ Misses       3240     3236    -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xlai20
xlai20 marked this pull request as ready for review September 2, 2026 03:10
@xlai20
xlai20 requested review from a team as code owners September 2, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant