Skip to content

Conversation

@shubham-up-47
Copy link
Contributor

@shubham-up-47 shubham-up-47 commented Sep 17, 2025

The AsyncWriter was using small values of LWM (256 KiB) and HWM (512 KiB). This caused the writer to flush data far too frequently, creating a bottleneck,

  • LWM i.e. Low Water Mark: When the write buffer size is equal to or greater than this value, the SDK code sets flush_=true and prepares for flush.
  • HWM i.e. High Water Mark: When the write buffer size is equal to or greater than this value, writes are paused until the buffer size reaches below the LWM.

This PR increases the default MinLwmValue from 256 KiB to 16 MiB which significantly reduce the number of flush operations, allowing the AsyncWriter to batch more data and achieve much higher throughput. The new default is chosen based on Nokoro test results which demonstrated optimal performance at 16 MiB,

  • 4 MiB LWM: ~275 MiB/s throughput
  • 8 MiB LWM: ~470 MiB/s throughput
  • 16 MiB LWM: ~603 MiB/s throughput
  • 32 MiB LWM: ~305 MiB/s throughput

This change is Reviewable

@shubham-up-47 shubham-up-47 requested review from a team as code owners September 17, 2025 09:47
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Sep 17, 2025
@codecov
Copy link

codecov bot commented Sep 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.04%. Comparing base (3962f01) to head (5189b9d).
⚠️ Report is 108 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15552   +/-   ##
=======================================
  Coverage   93.04%   93.04%           
=======================================
  Files        2408     2408           
  Lines      220145   220145           
=======================================
  Hits       204829   204829           
  Misses      15316    15316           

☔ View full report in Codecov by Sentry.
📢 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.

@shubham-up-47 shubham-up-47 changed the title feat(storage): Increase AsyncWriter default MinLwmValue to avoid frequent flushes fix(storage): Increase AsyncWriter default MinLwmValue to avoid frequent flushes Sep 22, 2025
Copy link
Member

@scotthart scotthart left a comment

Choose a reason for hiding this comment

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

@scotthart reviewed 1 of 1 files at r1, 3 of 3 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @shubham-up-47)

@shubham-up-47 shubham-up-47 merged commit c72fcb3 into googleapis:main Sep 23, 2025
67 of 72 checks passed
@shubham-up-47 shubham-up-47 deleted the avoid_frequent_flush branch September 23, 2025 15:27
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.

3 participants