简体   繁体   English

哪个组件在ASP.NET Core中处理线程分配?

[英]Which component is handling thread allocation in ASP.NET Core?

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.). 在以前的asp.net版本中,框架负责从线程池中分配所有线程,并且web.config中有一个配置来设置它(最大线程数等)。 So which component is responsible for it in the new ASP.NET? 那么哪个组件在新的ASP.NET中负责呢? I have not found any special middleware for that, I guess that it should happen even before the middleware, maybe in Kestrel. 我没有找到任何特殊的中间件,我想它应该发生在中间件之前,也许在Kestrel中。

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 . 线程池是一个CLR资源,可以直接在您的启动中配置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 请参阅https://github.com/aspnet/KestrelHttpServer/blob/01e9101543906ffd39239efd2f7bb41dbd879902/src/Microsoft.AspNetCore.Server.Kestrel/KestrelServerOptions.cs#L90

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM