Threading in ASP.NET

G

Guest

Was having a few problems with some threading issues following the microsoft support webcast Microsoft ASP.NET Threading. Spoke to Wade Mascia & managed to get clarification. Thought i'd share it with you...

From: Wade Mascia

Hi Craig

As for resources, keep an eye out for a book we're working on. So far it's just code named (PerfNScale), but it will probably come out with a name like "Improving Distributed Application Performance". It is the next in our "patterns & practices" series, such as

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/secnetlpMSDN.as

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/ThreatCounter.as

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/dbgrm.as

As for minFreeThreads..

The name: I agree with you minExternalRequestFreeThreads and minLocalRequestFreeThreads would be more explicitly clear.

Your understanding: it's not quite right. There's no separate pool, etc. When a request comes in, ASP.NET just uses these settings to decide if it will call ThreadPool.QueueUserWorkItem or not. If there are greater than "minXXXFreeThreads" available in the ThreadPool, then ASP.NET will make this call to process the next request in ASP.NET's RequeustQueue. If not, then ASP.NET will let the request sit in the RequestQueue and wait for more threads to become available before making the call. If the request is external then it uses the minFreeThreads setting, and if the request is local then it uses minLocalRequestFreeThreads. It's solely an ASP.NET concept (it's not something built into the System.Threading.ThreadPool class)

The statement: the reason this makes sense is as follows... external requests will not be executed if the threadpool is depleted to the point that there are not enough threads available to meet the minFreeThreads requirement. But local requests will only be queued if the threadpool is so depleted that it doesn't even meet the minLocalRequestFreeThreads requirement. The greater the difference (the smaller minLocal is vs. minFree) then the more priority you are giving to local requeusts, since you are effectively increasing the range of values where a local request can be executed but an external request would have to wait

Hope this helps. Please post this on a newsgroup somewhere if you don't mind

Thanks

~Wade Mascia, MCS




-----Original Message----
From: Craig Edmund


Hi Wade

I've just watched your webcast, and found it very informative. This is a subject that doesn't get much detailed coverage & I'm wondering if you can recommend any good resources, specifically on the threadpool & how it's used. Things like

how are minFreeThreads implemented? Is it simply a second queue that workitems are added to & managed pretty much as another pool when load dictates

From the explanation you gave shouldn't minFreeThreads really be called minExternalRequestFreeThreads? With the naming convention currently used i understood minFreeThreads to be the total number reserved and minLocalRequestFreeThreads are the number of them reserved for local requests. This would obviously mean minLocalRequestFreeThreads could never be greater than minFreeThreads and the passage "The greater the difference between these two numbers, the more priority you're giving to local requests." doesn't really make sense

Thanks very much for your time

Regard
Crai
 
A

Alvin Bruney [MVP]

Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
craigedmunds said:
Was having a few problems with some threading issues following the
microsoft support webcast Microsoft ASP.NET Threading. Spoke to Wade
Mascia & managed to get clarification. Thought i'd share it with you....
From: Wade Mascia


Hi Craig,

As for resources, keep an eye out for a book we're working on. So far
it's just code named (PerfNScale), but it will probably come out with a name
like "Improving Distributed Application Performance". It is the next in our
"patterns & practices" series, such as:
minLocalRequestFreeThreads would be more explicitly clear.
Your understanding: it's not quite right. There's no separate pool, etc.
When a request comes in, ASP.NET just uses these settings to decide if it
will call ThreadPool.QueueUserWorkItem or not. If there are greater than
"minXXXFreeThreads" available in the ThreadPool, then ASP.NET will make this
call to process the next request in ASP.NET's RequeustQueue. If not, then
ASP.NET will let the request sit in the RequestQueue and wait for more
threads to become available before making the call. If the request is
external then it uses the minFreeThreads setting, and if the request is
local then it uses minLocalRequestFreeThreads. It's solely an ASP.NET
concept (it's not something built into the System.Threading.ThreadPool
class).
The statement: the reason this makes sense is as follows... external
requests will not be executed if the threadpool is depleted to the point
that there are not enough threads available to meet the minFreeThreads
requirement. But local requests will only be queued if the threadpool is so
depleted that it doesn't even meet the minLocalRequestFreeThreads
requirement. The greater the difference (the smaller minLocal is vs.
minFree) then the more priority you are giving to local requeusts, since you
are effectively increasing the range of values where a local request can be
executed but an external request would have to wait.
Hope this helps. Please post this on a newsgroup somewhere if you don't mind.

Thanks,

~Wade Mascia, MCSD







-----Original Message-----
From: Craig Edmunds




Hi Wade,

I've just watched your webcast, and found it very informative. This is a
subject that doesn't get much detailed coverage & I'm wondering if you can
recommend any good resources, specifically on the threadpool & how it's
used. Things like:
how are minFreeThreads implemented? Is it simply a second queue that
workitems are added to & managed pretty much as another pool when load
dictates?
From the explanation you gave shouldn't minFreeThreads really be called
minExternalRequestFreeThreads? With the naming convention currently used i
understood minFreeThreads to be the total number reserved and
minLocalRequestFreeThreads are the number of them reserved for local
requests. This would obviously mean minLocalRequestFreeThreads could never
be greater than minFreeThreads and the passage "The greater the difference
between these two numbers, the more priority you're giving to local
requests." doesn't really make sense?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top