473,320 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Threading in ASP.NET

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
1 2072
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
by: Anthony_Barker | last post by:
I have been reading a book about the evolution of the Basic programming language. The author states that Basic - particularly Microsoft's version is full of compromises which crept in along the...
2
by: Egor Bolonev | last post by:
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program==================== import os, os.path, threading, sys def...
77
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
6
by: CK | last post by:
I have the following code in a windows service, when I start the windows service process1 and process2 work fine , but final process (3) doesnt get called. i stop and restart the windows service...
2
by: Vjay77 | last post by:
In this code: Private Sub downloadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Not (Me.downloadUrlTextBox.Text = "") Then Me.outputGroupBox.Enabled = True...
11
by: Paul Sijben | last post by:
I am stumped by the following problem. I have a large multi-threaded server accepting communications on one UDP port (chosen for its supposed speed). I have been profiling the code and found...
17
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. ...
0
by: kingcrowbar.list | last post by:
Hello Everyone I have been playing a little with pyGTK and threading to come up with simple alert dialog which plays a sound in the background. The need for threading came when in the first...
7
by: Mike P | last post by:
I am trying to write my first program using threading..basically I am moving messages from an Outlook inbox and want to show the user where the process is up to without having to wait until it has...
126
by: Dann Corbit | last post by:
Rather than create a new way of doing things: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html why not just pick up ACE into the existing standard:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.