我的应用程序存在一些性能问题,我似乎无法找出发生的原因。
该应用程序是作为 Azure Web 应用程序托管的 .NET 5 应用程序。该应用程序非常庞大,总共有 1000 行代码,并且有大约 1000 个并发用户。我不太确定如何提供正确的详细信息,但我很乐意提供您要求的任何内容。
对于大多数请求来说,请求响应时间通常在 20-50 毫秒之间。
但在一天中的某些时候,某些响应可能需要长达几分钟的时间,并且持续几分钟,然后恢复正常。
期间检查数据库,一切正常。数据库中没有大的峰值,并且还检查了该时间段的应用程序见解,数据库调用似乎需要几毫秒。
奇怪的是,似乎时间因超时/等待/其他原因而丢失。 IP 有一个调用,使用 async wait 对其他服务进行两次 http 调用,在应用程序见解日志中,第一个调用在 20 毫秒内完成,第二个调用在 20 毫秒内完成,但总方法使用了 1.5 分钟。第一个和第二个 http 请求之间的时间戳使得应用程序看起来像是在第一次调用后等待了 1.5 分钟才进行第二次调用。
难道是所有的 ASP.NET 应用线程都被用完了吗?我无法找出任何地方的 Azure Web Apps 中托管的 .net 5 应用程序的最大并发线程数。如果等待任务完成时没有可用线程,async/await 会发生什么情况?
在此期间,服务的 CPU 和内存根本没有达到最大使用率,但约为 20-30%。
还有什么其他想法可能导致这种非常奇怪的行为吗?有什么数据需要我提供吗?
这是 Azure 中响应时间的图表,清楚地表明这些峰值经常发生。
I have some performance problems with an application that I can't seem to find out why happens.
The application is a .NET 5 application hosted as a Azure Web App. The app is a very large one thousand of code lines in total, and a round 1000 concurrent users. I'm not really sure how to give the correct details, but I'll happily provide whatever you request.
What happens is that request response time usually lay in the 20-50ms for most requests.
But some times during the day, for some responses it can take up to a couple of minutes, and that lasts for some minutes, and then back to normal.
When checking the database during that time, everything seems normal. No large spikes in db, and also checking app insights for the time period, the db calls seems to take a few milliseconds.
What is strange is that is seems that the time is lost for timeouts/awaiting/whatever. IP had a call that does two http calls to other services using async await, and in the app insights logs, the first call is done in 20 ms, and the second is done in 20 ms, but the total methos used 1.5 minutes. And the timestamp between the first and second http request makes it look like the app waited 1.5 minutes after the first call before doing the second call.
Could it be something like all the asp.net app thread being used up? I could not find out what is the max cocurrent threads in a .net 5 app hosted in Azure Web Apps anywhere. What happens with async/await if there are no available threads when the awaited task is done?
CPU and memory for the service is not at all maxed out during this time, but are at around 20-30%.
Any other idea of what could cause this very strange behaviour? Any data you need me to provide?
This is the graph for response time in Azure that clearly show these spikes happen fairly often.
发布评论
评论(1)
为了达到上述要求,基于这个 微软文档疑难解答:
根本原因如下:
请参阅上面提供的 MS DOC 进行故障排除。
根据此 GitHub 链接 ,
有关详细信息,请参阅以下链接:
To achieve the above requirement , Based on this Troubleshot MICROSOFT DOCUMENTATION:
There are below root cause:
Please refer the above provided MS DOC for troubleshot .
According to this GitHub link ,
For more information Please refer the below links: