In previous versions of asp.net the framework was responsible for allocating all the threads from thread pool and there was a configuration in the web.config to set it up (maximum number of threads, etc.). So which component is responsible for it in the new ASP.NET? I have not found any special middleware for that, I guess that it should happen even before the middleware, maybe in Kestrel.
ASP.NET Core apps should be designed to process many requests simultaneously. Asynchronous APIs allow a small pool of threads to handle thousands of concurrent requests by not waiting on blocking calls. Rather than waiting on a long-running synchronous task to complete, the thread can work on another request.
ASP.NET MVC 5 for Beginners A thread is defined as the execution path of a program. Each thread defines a unique flow of control.
By default Dotnet sets this value as the number of hardware threads available based on the CPU setting — 16. This means after all 16 threads are in use and 5 new requests come in. Dotnet thread pool will wait 0.5 second for each request then check if a thread becomes free, if yes allots that to the request.
The threadpool is a CLR resource that can be configured directly in your Startup https://msdn.microsoft.com/en-us/library/system.threading.threadpool%28v=vs.110%29.aspx.
I think what you're actually asking about is configuring how many threads the servers will use to process requests, correct? See https://github.com/aspnet/KestrelHttpServer/blob/01e9101543906ffd39239efd2f7bb41dbd879902/src/Microsoft.AspNetCore.Server.Kestrel/KestrelServerOptions.cs#L90
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With