Buddy Ackerman said:
OK, .NET, being multithreaded, can issue multiple statements
asynchronously
(because each web request is handled by it's own thread). So, if I have
100
users hitting my web site simultaneously then I could possibly have 100
threads making a call to the database.
--It depends totally on the MaxWorker threads.
http://msdn2.microsoft.com/en-us/library/5dws599a.aspx
If the class was not static then
there could be 100 independent calls to the database happening instead of
99
calls waiting for the first one to finish.
--It's more an issue of static methods but that's splitting hairs. Each of
these assumptions though isn't necessarily or always true and depends on
quite a bit of things. You could have threaded application that blocks.
The big difference here is between Processes and threads and it sounds like
they're being confused somewhat. Static are used all over the place in
ASP.NET, for instance, FormsAuthentication. You can certainly cause
problems if you use statics incorrectly but it doesn't sound like your
spinning any of your own threads. If you're not and you're dealing with
stateless members, then you really don't have much to worry about here.
The DB server (i.e SQL server in
this case) is a multi-cpu box that can process many commands at once and
return them in an asynchronous order. So maybe the first call was a long
running transaction (long running meaning maybe 10 seconds) and the second
call was less than a second. If the class is static does the second call
to
the same method have to wait for the first one to complete before it could
be sent to the database for processing? the short answer is no. You could
construct a scenario where it would, but this isn't default behavior and
again, you're not spinning your own threads so much of that is mitigated.
It's the difference in parallel