Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify reactor utilization metrics #2060

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

travisdowns
Copy link
Contributor

@travisdowns travisdowns commented Jan 28, 2024

The key CPU use metric for seastar is "reactor utilization". This is the time spent on CPU [1] except that doing busy polling (i.e., when there is no additional work to do but we continue polling for IO because "why not" and "that's how we set ourselves up to get disk completions").

However, we simply call this "CPU utilization" or "CPU busy time" in the metrics, which is confusing, since it is very different from actual OS-reported CPU utilization because it excludes polling time. This is a frequent source of confusion when people expect this to act like CPU utilization or use this interchangeably with CPU utilization reported by the OS (e.g., via node_exporter).

This change clarifies the description, calling it "Reactor non-polling CPU utilization". Furthermore, it also clarifies the specific definition of the utilization (gauge) variation of the metric: it is a five second rolling average.

The key CPU use metric for seastar is "reactor utilization". This is
the time spent on CPU [1] except that doing busy polling (i.e., when
there is no additional work to do but we continue polling for IO because
"why not" and "that's how we set things up to get disk completitions").

However, we simply call this "CPU utilization" or "CPU busy time" in the
metrics, which is confusing, since it is very different from actual
OS-reported CPU utilization because it excludes polling time. This is
a frequent source of confusion when people expect this to act like
CPU utilization or use this interchangeably with CPU utilization
reported by the OS (e.g., via node_exporter).

This change clarifies the description, calling it "Reactor non-polling
CPU utilization". Furthermore, it also clarifies the specific
definition of the utilization (gauge) variation of the metric: it is
a five second rolling average.
@travisdowns travisdowns force-pushed the td-upstream-reactor-util-description branch from cc0d442 to 765100d Compare January 28, 2024 16:36
@travisdowns
Copy link
Contributor Author

[1] Even calling it CPU utilization isn't strictly correct as it's a wall-time measurement, not a CPU time measurement (e.g., via rusage), so steal time will inflate reactor utilization, unlike how it works for competing processes and CPU utilization.

@travisdowns
Copy link
Contributor Author

travisdowns commented Jan 28, 2024

I suppose also "non-polling" is a bit imprecise, it should really be "non-busy-polling" as we do include in reactor utilization the polls we do when not idle, i.e., while there is still more work to do after.

Consider the beginning of a discussion.

@xemul
Copy link
Contributor

xemul commented Feb 2, 2024

A suggestion -- the proposed clarification is out-out-ish, it says that "this is CPU usage excluding what reactor does", but it could as well be opt-in-ish by saying smth like "this is CPU usage by tasks and timers"

@travisdowns
Copy link
Contributor Author

travisdowns commented Feb 2, 2024

A suggestion -- the proposed clarification is out-out-ish, it says that "this is CPU usage excluding what reactor does", but it could as well be opt-in-ish by saying smth like "this is CPU usage by tasks and timers"

In general I agree with that approach to phrasing things but the difficulty is that it really is defined as runtime - polling time, if I use the other approach I need to list all the things that the reactor could do that are useful? Tasks, timers, flushing sockets, reading from sockets, some types of polling for IO (i.e., when results are coming back).

Anyway, here's an attempt:

Total reactor CPU time in active processing. Active processing includes all work, such as running tasks, executing timers, submitting and reaping IO, but excludes idle polling and sleep.

WDYT?

@xemul
Copy link
Contributor

xemul commented Feb 2, 2024

Yes, you're right, opt-in it looks terrible. How about this then:

cpy_busy_time: Total cpu busy time in milliseconds excluding idle-polling
utilization: Average CPU busy time for the last 5-seconds

?

@travisdowns
Copy link
Contributor Author

@xemul :

How about this then:

cpy_busy_time: Total cpu busy time in milliseconds excluding idle-polling
utilization: Average CPU busy time for the last 5-seconds

I really wanted to have "reactor" in there as it was one of the clarifications I was trying to make: that this is time measured in the reactor, not just in seastar genreally: e.g., it does not include time that the syscall thread or any alien threads are running. I think the description needs to standalone since the metric name/group is usually not visible, so it's not obvious we are talking about reactor from the description.

So WDYT about:

cpy_busy_time: Total reactor CPU busy time in milliseconds excluding time spent idle-polling.
utilization: 5-second average of reactor CPU busy time, excluding time spent idle-polling, in percent.

@xemul
Copy link
Contributor

xemul commented Feb 5, 2024

So WDYT about:

cpy_busy_time: Total reactor CPU busy time in milliseconds excluding time spent idle-polling.
utilization: 5-second average of reactor CPU busy time, excluding time spent idle-polling, in percent.

👍 let's go this way

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.

None yet

2 participants