-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
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.
@@ -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})"; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
@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). |
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.