Home > View Post

Check ThreadPool levels

I'm posting this as much for me to keep as for anybody else, so I apologise if it seems a little boring.

Occasionally, after I've tuned the ThreadPool, I'll want to make sure that the changes have taken effect. Or maybe sometimes I'll just want to check the levels of the ThreadPool.

Simply drop this into an aspx file and put it in your application's (site or service) virtual directory:

<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Threading" %>

int worker, io;

ThreadPool.GetAvailableThreads(out worker, out io);

Response.Write(string.Format("Available threads, worker:{0} io:{1} <br/>", worker, io));

ThreadPool.GetMinThreads(out worker, out io);

Response.Write(string.Format("Minimum threads, worker:{0} io:{1} <br/>", worker, io));

ThreadPool.GetMaxThreads(out worker, out io);

Response.Write(string.Format("Maximum threads, worker:{0} io:{1} <br/>", worker, io));


Now you can browse to the page and quickly see what's going on inside your threadpool.

Reminds me of those ASP classic days :)


Josh Post By Josh Twist
7:14 AM
03 Apr 2006

» Next Post: Refactoring and Design
« Previous Post: The Awesome Foxit Reader

Comments are closed for this post.

© 2005 - 2022 Josh Twist - All Rights Reserved.