Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements experimental request hedging for storage::AsyncClient::Open() stream-open handshakes. It introduces the HedgedOpenOperation class to manage racing the primary stream-open attempt against delayed speculative attempts, and extracts HedgeLimiter from HedgingThreadPool to enforce connection-wide concurrency and rate limits. Additionally, it refactors OpenObject and OpenStream to support robust cancellation during the stream-open handshake, and adds comprehensive unit tests to verify these new behaviors. I have no feedback to provide as there are no review comments.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #16612 +/- ##
==========================================
+ Coverage 92.78% 92.81% +0.02%
==========================================
Files 2277 2281 +4
Lines 228147 229185 +1038
==========================================
+ Hits 211696 212718 +1022
- Misses 16451 16467 +16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6e1f7c8 to
687163b
Compare
687163b to
b3ad928
Compare
b3ad928 to
e3c716f
Compare
c2f8dbb to
f2f54ed
Compare
14cafcc to
c7ed0e3
Compare
c7ed0e3 to
4be7490
Compare
Note
Stacked PR (Part 3 of 3): Stacked on #16613 (
fix(storage): make OpenStream and OpenObject cancellation-safe), #16715 (refactor(storage): extract HedgeLimiter from HedgingThreadPool), and #16716 (impl(storage): add HedgedOpenStream coordinator for async Open).5 files, +470 / -35, inline-commentable): Commit14cafcc660in #16612{#16613, #16715}(independent roots in parallel) → impl(storage): add HedgedOpenStream coordinator for async Open #16716 (after refactor(storage): extract HedgeLimiter from HedgingThreadPool #16715) → feat(storage): add speculative open hedging to AsyncClient::Open #16612 (this PR, after both fix(storage): make OpenStream and OpenObject cancellation-safe #16613 and impl(storage): add HedgedOpenStream coordinator for async Open #16716).main, their prerequisite commits drop out of this PR automatically.Summary
Extends
storage_experimental::EnableReadHedgingOptiontostorage::AsyncClient::Open()(BidiReadObject) by wiringAsyncConnectionImpl::Open()toHedgedOpenStream(#16716) andHedgeLimiter(#16715), racing slow initial stream-open handshakes against delayed speculative attempts on the gRPCCompletionQueue.Motivation
Opening a
BidiReadObjectstream requires a multi-step handshake (Start()-> initialWrite()-> firstRead()returning object metadata and aBidiReadObjectHandle) and can experience severe tail-latency spikes when an individual subchannel, backend task, or DirectPath/CloudPath route stalls during connection setup or backend routing. Previously,EnableReadHedgingOptiononly hedged synchronousstorage::Client::ReadObject()streams, leavingstorage::AsyncClient::Open()vulnerable to single-attempt open stalls until the per-stream stall timeout (DownloadStallTimeoutOption) expired.Racing the initial
Open()handshake against bounded, delayed speculativeOpen()attempts cutsBidiReadObjectopen tail latency without duplicating any subsequentObjectDescriptor::Read()ranged-read payload transfers or spawning dedicated worker thread pools.Changes
AsyncConnectionImplWiring (google/cloud/storage/internal/async/connection_impl.{h,cc}):HedgeLimiter(ReadHedgeRateLimitOption,MaxConcurrentHedgesOption,MaxTotalHedgesOption) andHedgedReadMetricswhenEnableReadHedgingOptionis enabled at client creation.AsyncConnectionImpl::Open(): short-circuits onhedge_limiter_ && !hedge_limiter_->IsTotalBudgetSpent()before anyOptionshash-map lookups and movesretry/backoff/currentintoclean_resume_factorylast with zero extra atomicshared_ptrrefcount traffic.TrackedFeature::kReadHedging(x-goog-storage-cpp-features) strictly to initial hedgedOpen()attempts (OpenHedging::kEnabled), keeping MSO standby streams and mid-stream descriptor resumes unhedged and untagged (OpenHedging::kDisabled).google/cloud/storage/options.h,google/cloud/storage/async/client.h):AsyncClient::Open()support (including per-call overrides, connection-wide limiter options, andstorage::AsyncClient::InitialReadRangesbehavior) onEnableReadHedgingOption,MaxTotalHedgesOption,ReadHedgeDelayOption,MaxReadHedgesOption, andAsyncClient::Open(), and notes sync-only options (MaximumHedgeBufferOption,ReadThreadPoolSizeOption,HedgingThreadPoolSizeOption).google/cloud/storage/internal/async/connection_impl_open_test.cc):GatingAndPerCallOverrides,FeatureHeaderSetOnlyOnHedgedOpenAttempts, andSlowPrimaryHedgeWinsAndResumeIsUnhedged), complementing the standalone coordinator unit/concurrency tests in impl(storage): add HedgedOpenStream coordinator for async Open #16716.