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

前端 未结 4 2256
予麋鹿
予麋鹿 2020-12-29 06:04

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

4条回答
  •  孤独总比滥情好
    2020-12-29 06:34

    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.

提交回复
热议问题