Skip to content

Record event dispatcher read/write latency in microseconds - #3681

Open
ehds wants to merge 1 commit into
apache:masterfrom
ehds:hds/fix-event-dispatcher-latency-units
Open

ehds wants to merge 1 commit into
apache:masterfrom
ehds:hds/fix-event-dispatcher-latency-units

Conversation

@ehds

@ehds ehds commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: resolve

Problem Summary:

What is changed and the side effects?

LatencyRecorder defines latency_us = latency * latency_scale_factor, with latency_scale_factor defaulting to 1. Therefore, callback durations passed to the recorder should be in microseconds under the default configuration.

A callback lasting over approximately 2.15 seconds could produce an IntRecorder overflow warning.

Changed:

Event dispatcher read and write callback durations should measured in microsecond values.

Side effects:

  • Performance effects:

  • Breaking backward compatibility:


Check List:

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the callback timing changes from nanoseconds to microseconds.

No open issues 🎉

What changed in this PR

This PR corrects event dispatcher callback timing to use microseconds, matching LatencyRecorder’s default unit.

Changes:

  • Switches read and write callback measurements from nanoseconds to microseconds in both dispatcher backends.
  • Renames timing variables to start_us, keeping names consistent with the recorded values.
File Description
src/​brpc/​event_dispatcher_kqueue.cpp Records kqueue read/write callback durations in microseconds.
src/​brpc/​event_dispatcher_epoll.cpp Records epoll read/write callback durations in microseconds.

Review effort: Balanced

@chenBright chenBright left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants