Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is ASP.NET multithreaded (how does it execute requests)

Tags:

This might be a bit of a silly question but;

If I have two people logging on to my site at exactly the same time, will the server side code be executed one after the other or will they be executed simultaneously in separate threads?

I'm curious in regards to a denial of service attack on a website login. Does the server slow down because it has a massive queue of logins or is it slow because it has a billion simultaneous logins!

like image 533
DomBat Avatar asked Jan 12 '09 14:01

DomBat


Video Answer


2 Answers

This is not related to ASP.NET per se (I have very little knowledge in that area), but generally web servers. Most web servers use threads (or processes) to handle requests, so basically, whatever snippet of code you have will be executed for both connections in parallel. Of course, if you access a database or some other backend system where a lock is placed, allowing just one session to perform queries, you might have implicitly serialized all requests.

Web servers typically have a minimum and maximum number of workers, which are tuned to the current hardware (CPUs, memory, etc). If these are exhausted, new requests will be queued waiting for a worker to become available, or until a maximum queue length of pending requests has been reached at which point it disregards new connections, effectively denying service (if this is on purpose, it's called a denial of service or DoS attack).

So, in your terms it's a combination, it's a huge number of simultaneous requests filling up the queue.

like image 185
falstro Avatar answered Oct 30 '22 20:10

falstro


It should use a thread pool. Note that they are still in the same application, so application level items like static variables are still shared between them.

like image 33
Joel Coehoorn Avatar answered Oct 30 '22 19:10

Joel Coehoorn