简体   繁体   中英

ASP.Net Core Thread Starvation in high load

We are migrating a large code base from.Net Framework 4.7.2 ASP.NET to .NET 6 ASP.NET Core (Hosted in IIS 10).

Unfortunately we noticed a regression in high load scenarios. The ASP.NET was able to recover from load peaks, while ASP.NET Core enters thread starvation and only recovers if load is reduced and even then it takes minutes. Due to Oracle not providing a true async API, a large part of our code base runs synchronously.

Our current hypothesis for the difference is the missing default request queue that was present in ASP.NET (?). The naive approach would be to introduce a rate limiting middleware, but hard coding the number of concurrent requests that are allowed seems problematic. Is there a way to configure ASP.NET Core so that it starts to throttle/rate limit the number of requests as it approaches thread starvation?

We assume we would need something like this: https://referencesource.microsoft.com/#System.Web/RequestQueue.cs,8

We received great intel in this github issue: https://github.com/do.net/as.netcore/issues/45277#issuecomment-1327156897

Our assumption about the throtteling differences between ASP.NET and ASP.NET Core are correct and it is neccessary to build your own Throtteling Middleware, upgrade to ASP.NET Core 7 or use OpenSource solutions. The default values for ASP.NET + IIS are:

- System.Web request queue - 5000 * number of CPUs (setting is called maxConcurrentRequestsPerCPU)
- IIS concurrent request limit - 5000 (appConcurrentRequestLimit)
- HTTP.sys queue - 1000 (https://learn.microsoft.com/en-us/windows/win32/http/configuring-properties-in-http-version-2-0?redirectedfrom=MSDN)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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