Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does an ASP.NET HTTP Request Translate to 1 Thread?

Tags:

http

asp.net

Is it safe to assume that when a user requests an .aspx page via HTTP, that ASP.NET creates at least 1 thread for it?

If so, how long does it last?

If 1000 people make the HTTP request to the same .aspx page, is there some recycling of threads involved, so it doesn't spawn different 1000 threads?

like image 699
SaltProgrammer Avatar asked Nov 10 '11 18:11

SaltProgrammer


People also ask

Is ASP NET single threaded?

In short, ASP.NET is multithreaded and when processing a particular request, may even switch to another thread at particular steps during the request life cycle (and it could be worse with async pages).

How many threads does ASP Net use?

ASP.NET Threading Inside the ASP.NET Worker Process, there are two thread pools. The worker thread pool handles all incoming requests and the I/O Thread pool handles the I/O (accessing the file system, web services and databases, etc.).

Does ASP Net use threads?

A thread is defined as the execution path of a program. Each thread defines a unique flow of control.

Is .NET multi threaded?

With . NET, you can write applications that perform multiple operations at the same time. Operations with the potential of holding up other operations can execute on separate threads, a process known as multithreading or free threading.


1 Answers

Each request is allocated a thread from the iis page pool. the idea is that this should be a short running process so that thread can be returned to the page pool for use by another request coming (page pool sizes are not huge, usually, like 50). So, if you have a long running request, it's important you make an async call to free the thread for some other request. then, on your long running requests completion, you will get another thread from the pool and finish up.

Bottom line, if 1000 people make requests at the same time and none of them finish, 50 or so will run and the other 950 will wait.

like image 91
Peter Kellner Avatar answered Oct 05 '22 03:10

Peter Kellner