Skip to content

drpc: add write queue pressure metrics#67

Merged
shubhamdhama merged 1 commit into
mainfrom
shubham/blocked-writers
Jul 16, 2026
Merged

drpc: add write queue pressure metrics#67
shubhamdhama merged 1 commit into
mainfrom
shubham/blocked-writers

Conversation

@shubhamdhama

@shubhamdhama shubhamdhama commented Jun 30, 2026

Copy link
Copy Markdown

DRPC combines writes from many streams in a bounded connection queue and
sends batches through one transport write. Bytes sent cannot tell whether
work is waiting in the queue, stream writers are stalled at its limit, or a
batch is stuck in Write.

Add queue bytes, blocked writers, queue-block events, and in-flight flush
bytes to expose that pressure. These signals distinguish producer
backpressure from a slow or stalled transport write.

Keep collection policy with the connection metric bundle and give that
bundle directly to the writer. This makes queue metric updates visible at
the state transitions that cause them, removes callback plumbing from the
writer options, and applies the same recording gate across connection
metrics.

Duration distributions remain separate histogram work.

@shubhamdhama
shubhamdhama force-pushed the shubham/receive-queue branch from 4a7db46 to 35a3cbe Compare July 13, 2026 06:03
@shubhamdhama
shubhamdhama force-pushed the shubham/blocked-writers branch 2 times, most recently from 311781e to 75a9b78 Compare July 13, 2026 07:20
@shubhamdhama shubhamdhama changed the title drpc: add write-backpressure blocked-writers metric drpc: add write queue pressure metrics Jul 13, 2026

@suj-krishnan suj-krishnan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM - we still need a histogram for avg blocked time but that is mentioned as a TODO.

@shubhamdhama
shubhamdhama force-pushed the shubham/receive-queue branch from 35a3cbe to 7ba8a1d Compare July 14, 2026 17:16
@shubhamdhama
shubhamdhama force-pushed the shubham/blocked-writers branch from 75a9b78 to 342b458 Compare July 14, 2026 17:16
@shubhamdhama
shubhamdhama force-pushed the shubham/receive-queue branch from 7ba8a1d to 8ea5c1b Compare July 15, 2026 07:19
@shubhamdhama
shubhamdhama force-pushed the shubham/blocked-writers branch from 342b458 to ea8e8da Compare July 15, 2026 07:19
@shubhamdhama
shubhamdhama force-pushed the shubham/receive-queue branch from 8ea5c1b to 69ef373 Compare July 15, 2026 08:25
@shubhamdhama
shubhamdhama force-pushed the shubham/blocked-writers branch from ea8e8da to caba7e9 Compare July 15, 2026 08:25
@shubhamdhama
shubhamdhama force-pushed the shubham/receive-queue branch from 69ef373 to 09097b0 Compare July 15, 2026 10:32
@shubhamdhama
shubhamdhama force-pushed the shubham/blocked-writers branch from caba7e9 to 1e7c8e2 Compare July 15, 2026 10:32
@shubhamdhama
shubhamdhama force-pushed the shubham/receive-queue branch from 09097b0 to 43d48f0 Compare July 15, 2026 10:55
@shubhamdhama
shubhamdhama force-pushed the shubham/blocked-writers branch from 1e7c8e2 to ceec8a6 Compare July 15, 2026 10:55
Base automatically changed from shubham/receive-queue to main July 15, 2026 13:40
@shubhamdhama
shubhamdhama force-pushed the shubham/blocked-writers branch from ceec8a6 to 8891758 Compare July 15, 2026 13:56
DRPC combines writes from many streams in a bounded connection queue
and sends batches through one transport write. Byte counters cannot show
whether work is queued, writers are stalled, or a batch is stuck in
Write.

Add write_queue.bytes, write_queue.blocked_writers,
write_queue.block_count, and write_flush.in_flight_bytes. These signals
distinguish producer backpressure from a slow or stalled transport
write.

Keep the recording gate in ConnectionMetrics and pass that bundle
directly to the writer. This makes updates visible at the state
transitions that cause them and removes callback plumbing from writer
options.

Duration distributions remain separate histogram work.
@shubhamdhama
shubhamdhama force-pushed the shubham/blocked-writers branch from 8891758 to c97c39d Compare July 16, 2026 06:23
@shubhamdhama
shubhamdhama merged commit 0af977f into main Jul 16, 2026
3 checks passed
@shubhamdhama
shubhamdhama deleted the shubham/blocked-writers branch July 16, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants