Skip to content

Add a metric to capture write enqueue latency#193

Open
jasonk000 wants to merge 2 commits into
jkoch/loop-cpu-utilization-metricfrom
jkoch/loop-enqueue-to-write-latency-metric
Open

Add a metric to capture write enqueue latency#193
jasonk000 wants to merge 2 commits into
jkoch/loop-cpu-utilization-metricfrom
jkoch/loop-enqueue-to-write-latency-metric

Conversation

@jasonk000
Copy link
Copy Markdown
Member

This captures from when the caller tries to send a request until the request is finally sent on the wire, primarily so we can see when the enqueue time is increasing (a signal for pressure on the IO loop).

This captures from when the caller tries to send a request until the
request is finally sent on the wire, primarily so we can see when the
enqueue time is increasing (a signal for pressure on the IO loop).
Copy link
Copy Markdown

@akhaku akhaku left a comment

Choose a reason for hiding this comment

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

technically not sent on the wire but passed to the non-blocking socket, right?

Generally LGTM

if (wc <= 0L || wc < operationAttachedNs) return;
loopEnqueueToWriteLatency.record(wc - operationAttachedNs, TimeUnit.NANOSECONDS);
} catch (Throwable t) {
if (log.isDebugEnabled()) log.debug("recordLoopEnqueueToWriteLatency failed", t);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we don't really need the isDebugEnabled check here right since the expression in log.debug is cheap

Copy link
Copy Markdown
Member Author

@jasonk000 jasonk000 May 18, 2026

Choose a reason for hiding this comment

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

Yes. Updated the comments to make that more clear, and dropped that catch there since the onyl thing we have is a record() call. -> a6d34e2

@jasonk000 jasonk000 marked this pull request as ready for review May 18, 2026 19:24
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