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

Add label to io_threaded_fallbacks to categorize operations #108

Open
wants to merge 1 commit into
base: v24.3.x
Choose a base branch
from

Conversation

ballard26
Copy link

The main purpose of this PR is to allow us to know how many of the operations submitted to the thread pool are from failed aio reads/writes.

@@ -27,9 +27,53 @@ namespace seastar {

class reactor;

enum class submit_reason {
Copy link
Member

Choose a reason for hiding this comment

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

Missing doc.

Copy link
Member

Choose a reason for hiding this comment

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

(should probably document each reason as well)

Copy link
Author

Choose a reason for hiding this comment

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

Added docs.

uint64_t process_operation{0};
uint64_t unknown{0};

void record_reason(submit_reason reason) {
Copy link
Member

Choose a reason for hiding this comment

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

I think it is better to make this "generic" (i.e., no need for O(n) clauses for n reasons), e.g., using an array of counters and indexing with the enum value.

Copy link
Author

Choose a reason for hiding this comment

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

Oooh, I like that idea. Will switch the code over to that.

Copy link
Author

Choose a reason for hiding this comment

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

Done

}
}

uint64_t count_for(submit_reason reason) const {
Copy link
Member

Choose a reason for hiding this comment

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

This can also be generic.

Copy link
Author

Choose a reason for hiding this comment

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

Changed

return inter_thread_wq.submit<T>(std::move(func));
}
uint64_t operation_count() const { return _aio_threaded_fallbacks; }
Copy link
Member

Choose a reason for hiding this comment

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

Why is this deleted? It could still be implemented with the same semantics as before, right?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, summing all the reasons will have the same semantics as before. It's just not used anywhere else in the codebase so I removed it as dead code.

Copy link
Member

Choose a reason for hiding this comment

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

I see, because the old metric is replaced entirely with the one the labels, makes sense. Not sure if seastar team will buy into not keeping the old metric (w/o labels) around but let's see.

@@ -27,9 +27,53 @@ namespace seastar {

class reactor;

enum class submit_reason {
Copy link
Member

Choose a reason for hiding this comment

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

(should probably document each reason as well)

@ballard26 ballard26 force-pushed the metrics-for-thread-pool branch from 57dc8bb to 4974a41 Compare April 30, 2024 21:34
@ballard26 ballard26 requested a review from travisdowns April 30, 2024 21:36
@ballard26 ballard26 force-pushed the metrics-for-thread-pool branch from 4974a41 to 646adfb Compare April 30, 2024 22:19
sm::description("Total number of io-threaded-fallbacks operations")),

io_fallback_counter("aio_fallback", submit_reason::aio_fallback),
// total_operations value:DERIVE:0:U
Copy link
Member

Choose a reason for hiding this comment

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

do you even understand these comments? I sure don't.

Copy link
Member

Choose a reason for hiding this comment

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

@@ -27,9 +27,36 @@ namespace seastar {

class reactor;

// Reasons for why a function had to be submitted to the thread_pool
enum class submit_reason : size_t {
// Used for aio operations what would block in `io_submit`.
Copy link
Member

Choose a reason for hiding this comment

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

Just to clarify, isn't it actually "used as a fallback for io operations that failed to execute in a non-blocking manner in their first submission to io_submit"?

Maybe it's splitting hairs but the way it's written makes it sounds like we know that some operation will block and then we can redirect them to the thread pool, but it's actually based on what happened on a per-op basis during submission, right?

Copy link
Author

Choose a reason for hiding this comment

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

Fair, I probably removed too much context in an attempt to make the comment succinct. Will add some back.

@ballard26 ballard26 changed the base branch from v24.1.x to v24.3.x October 18, 2024 23:40
@ballard26 ballard26 changed the base branch from v24.3.x to v24.1.x October 18, 2024 23:42
@ballard26 ballard26 force-pushed the metrics-for-thread-pool branch from 646adfb to f538975 Compare October 19, 2024 00:02
@ballard26 ballard26 changed the base branch from v24.1.x to v24.3.x October 19, 2024 00:02
@ballard26
Copy link
Author

@travisdowns the branch has been rebased to v24.3.x. Going to get a PR up for this in upstream seastar as well.

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.

3 participants