By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

Threading in ASP.NET

P: n/a
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/de...ecnetlpMSDN.as

http://msdn.microsoft.com/library/de...reatCounter.as

http://msdn.microsoft.com/library/de.../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

Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <an*******@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com...
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/de...cnetlpMSDN.asp
http://msdn.microsoft.com/library/de...eatCounter.asp
http://msdn.microsoft.com/library/de...html/dbgrm.asp

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, 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?

Thanks very much for your time.

Regards
Craig

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.