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

Exceptions: Add threadpool stats in .NET Core+ #1964

Merged
merged 5 commits into from
Jan 25, 2022

Conversation

NickCraver
Copy link
Collaborator

I swear I already did this somewhere but it got lost, this adds additional thread pool stats exposed in .NET Core 3.1+. We'll get for example ThreadPool.PendingWorkItemCount on exception messages to better indicate app contention.

I swear I already did this somewhere but it got lost, this adds additional thread pool stats exposed in .NET Core 3.1+. We'll get for example ThreadPool.PendingWorkItemCount on exception messages to better indicate app contention.
@NickCraver NickCraver requested a review from mgravell January 25, 2022 02:54
@@ -77,6 +77,13 @@ internal static int GetThreadPoolStats(out string iocp, out string worker)

iocp = $"(Busy={busyIoThreads},Free={freeIoThreads},Min={minIoThreads},Max={maxIoThreads})";
worker = $"(Busy={busyWorkerThreads},Free={freeWorkerThreads},Min={minWorkerThreads},Max={maxWorkerThreads})";

#if NETCOREAPP
workItems = $"(Threads={ThreadPool.ThreadCount},QueuedItems={ThreadPool.PendingWorkItemCount},CompletedItems={ThreadPool.CompletedWorkItemCount})";
Copy link
Collaborator

Choose a reason for hiding this comment

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

how often is this called? should I care about the string alloc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not a big fan of how existing works - was light touch, let's get existing PRs touching it in, then I'll add a bench and do a builder pass and such on the exception path, no reason we can't be civilized with the GC!

@NickCraver
Copy link
Collaborator Author

@mgravell allocated in the exception path - I don't think it's a major item but would like to go through and end-to-end builder these paths once existing PRs are in (several touch it).

@NickCraver NickCraver merged commit b81c5da into main Jan 25, 2022
@NickCraver NickCraver deleted the craver/exception-threadpool-stats branch January 25, 2022 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants