googleapis / googleapis/google-cloud-rust

Support publish hedging in pubsub::client::Publisher

Open
#6,776 2 comments 0 reactions 1 assignee Claimed by @suzmue View on GitHub
api: pubsub priority: p3 type: feature request
Dominant language
Rust
Stars
955
Forks
144
Avg merge
1d 5h
Merged PRs (30d)
279

Description

Support publish request hedging in `google-cloud-pubsub` to reduce p99/p99.9 tail latency caused by transient network stalls or slow backend tasks.
### Design
- **Hedging Mechanism:** When an in-flight batch publish exceeds a configured delay threshold, send a concurrent duplicate publish RPC and resolve the batch with whichever attempt finishes first.
- **Rate Limiting:** Rate-limit hedged RPCs using a token bucket that refills on successful publish RPCs.
- **Telemetry:** Attach the `x-goog-pubsub-client-telemetry` header to hedged attempts for backend tracking.
- **Ordering Safety:** Hedging does not apply for messages with ordering keys.
-
See java reference implementation: https://github.com/googleapis/google-cloud-java/pull/13735/changes

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.