Asp.net core 2对CORS预检请求的响应速度慢 [英] Asp.net core 2 Slow response to CORS preflight requests
问题描述
我们有一个asp.net core 2服务器. 在性能测试中,当我们有几个(例如数十个)待处理请求时,新的CORS预检请求将保持待处理状态.
We have an asp.net core 2 server. In performance tests, when we have a few (say tens of) pending requests, new CORS preflight requests stay pending.
asp.net核心似乎对管道中的并发请求数有一定的限制,并且该限制的默认值非常低.
It appears that asp.net core has a certain limit on the number of concurrent requests in pipeline, and the default value for that limit is very low.
关于这些与性能相关的主题是否有任何资源? 有办法确定请求的优先级吗?
Is there any resources about these performance related topics? Is there a way to prioritize requests?
当然,在优化其他请求之后,此问题将更难重现,因此我们希望对此有所了解.
Of course, after we optimize the other requests, this problem will get harder to reproduce, so we want to understand it well enough.
推荐答案
I had answered a similar question related to benchmarking performance for ASP.NET Core Kestrel here.
简而言之,您可以删除导致瓶颈的中间件,或者至少可以帮助您诊断罪魁祸首.
In short, you could remove the middleware that is causing the bottlenecks, or at least this could help you diagnose the culprit.
订购
中间件组件在Configure
方法中添加的顺序定义了在请求时调用它们的顺序,以及响应的相反顺序. 此顺序对于安全性,性能和功能至关重要.
Ordering
The order that middleware components are added in theConfigure
method defines the order in which they are invoked on requests, and the reverse order for the response. This ordering is critical for security, performance, and functionality.