Groups | Blog | Home
all groups > dotnet performance > december 2006 >

dotnet performance : threads



smarty
12/6/2006 11:49:00 PM
Hi,

I am trying to monitor the number of threads being used on multiple calls a
web service and files available for dowload through http.

Q1. What is the difference between process:inetinfo:thread count and
process:w3wp:thread count?

Q2. Is this the right counter to measure threads in use?

stcheng NO[at]SPAM online.microsoft.com
12/7/2006 12:06:03 PM
Hello smarty,

As for the "web service" you mentioned, is it an ASP.NET web application or
webservice application or a native IIS web service?

For the two questions you mentioned, here are my understanding and
suggestion:

Q1. What is the difference between process:inetinfo:thread count and
process:w3wp:thread count?
==================================
Inetinfo.exe is the IIS service's main process, however, for ASP.NET
application, it is always hosted in another process. For IIS5, its
aspnet_wp.exe, for IIS6, it is w3wp.exe


Q2. Is this the right counter to measure threads in use?
===================================
Do you want to get the thread numbers available for processing the ASP.NET
requests or the total threads number in the ASP.NET's worker process?


for ASP.NET request processing, the runtime will always use pooled thread
from .NET CLR's managed thread pool( rather than normal thread) to process
client requests. the "process" counter's thread count is the total
operating thread number. Here is a very good article introducing ASP.NET
threading model:

#Microsoft ASP.NET Threading
http://support.microsoft.com/default.aspx?scid=/servicedesks/webcasts/en/tra
nscripts/wct060503.asp

Also, you can create a custom counter for pickup the ASP.NET managed thread
pool status:

#How To: Monitor the ASP.NET Thread Pool Using Custom Counters
http://msdn2.microsoft.com/en-us/library/ms979194.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
smarty
12/9/2006 4:08:00 AM
Hi Steven,

I am looking to monitor similar thread counters for a web service and HTTP
application. For these I would like to know how many threads are being used
by each application and how many are still available.

This will allow me to see if any thread blocking is affecting performance
and if the thread pool needs to be increased.

[quoted text, click to view]
stcheng NO[at]SPAM online.microsoft.com
12/11/2006 12:00:00 AM
Thanks for your followup Smarty,

I think the .net managed threadpool's statistics are what you want. You can
create a custom to monitor the info.

Also, since you want to see whether your ASP.NET webservice application's
performance is hit by blocking thread, you can also checked the following
counters:

**Requests Queued

**Requests Rejected

#Performance Counters for ASP.NET
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconperformancecounter
sforaspnet.asp?frame=true


Generally, ASP.NET use clr threadpool's IO and Worker thread to process
requests. However, when there is no available thread pool thread, the
requests will be queued, and if it exceed queued limitation, any sequential
requests will be rejected. So the two counters are also very important.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
smarty
12/22/2006 2:32:01 AM
Hi Steven,

I have implemented the thread code you suggested. The maxworkerthreads and
maxiothreads seem to be set to 100, which is surprising because I thought
this was 20 per processor
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalenetchapt17.asp. Is the default value difference for .net 2 than .net 1.1?

Thanks

[quoted text, click to view]
Chris Mullins
12/22/2006 10:22:34 AM
IO Threads are different that threadpool threads.

There are typically 1000 IO Threads listed as being "available". These
threads are tied to IO Completion Ports, and aren't quite what you're
looking for. They're used for things like callbacks coming from
Socket.BeginRead/BeginWrite, or File.BeginRead/BeginWrite.

For standard processing, you want normal threadpool worker threads, which
are 25 per processor by default.

--
Chris Mullins

[quoted text, click to view]

smarty
12/24/2006 6:21:00 AM
Hi Chris,

Thanks for the info. The code in the listed article adds code to a aspx
page to which uses the ThreadPool.AvailableWorkerThreads and
ThreadPool.MaxWorkerThreads.

I have implemented the code and it returns 100 for the maxthreads and
available threads as well as maxiothreads which you suggested should be 100.

Is there anything obvious I am doing wrong?

Thanks

[quoted text, click to view]
stcheng NO[at]SPAM online.microsoft.com
12/25/2006 11:33:03 AM
Hi Smarty,

Thanks for your followup.

Yes, you're right. The value you get is the expected one. For .net
framework 2.0/ASP.NET 2.0, this setting has been changed, 25 is the default
value for ASP.NET 1.0/1.1 worker process(single-processor). And for 2.0,
based on my local test, the value identical to the one you meet(100), and
if your server have multi-processor or dual core, you also need to multiply
the value with processor count.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


AddThis Social Bookmark Button