发布Azure Web App之后的第一个请求变慢 [英] Slow first request after publishing Azure Web App

查看:125
本文介绍了发布Azure Web App之后的第一个请求变慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为Azure Web App托管的ASP.NET Web API应用程序出现性能问题.将第一个请求部署到Web服务之后,确实很慢(我们在这里谈论的是秒).后续请求工作正常,没有额外的延迟.

I have performance issue with ASP.NET Web API app hosted as Azure Web App. After deploying the first request to web service is really slow (we are talking about seconds here). Subsequent requests work just fine without extra delay.

始终开启"功能可以很好地阻止应用卸载,但这不能解决我的问题.我不希望第一个请求预热服务(顺便说一句-应该预热吗?).

"Always on" feature works fine keeping the app from unloading but this does not solve my issue. I do not want this first request to warm up the service (BTW - should it be warmed up?).

我在Azure中使用了诊断和性能分析工具,但没有找到引起此问题的根本原因.我也使用了Application Insights.我的一个功能似乎在第一个请求期间需要更多的时间来执行-在本地调试应用程序,我没有注意到所提到的功能有任何性能问题.

I've used diagnostic and profiling tools in Azure without finding the root cause of this thing. I've used Application Insights as well. It seems like one function of mine needs much more time to execute during this first request - debugging the app locally I did not notice any performance issue with mentioned function.

我该如何解决?

谢谢!

推荐答案

这也给我带来了困扰. 始终在线"只会自动调用您的服务根目录-考虑每次都对过程进行拍打,以使其不会进入睡眠状态..我们不在PROD服务中使用此过程,而是通过Azure可用性测试来调用每5分钟Ping()端点-两只小鸟,一只石头.此外,如果根目录中没有任何内容,AlwaysOn将在App Insights中生成404错误. 完全不同的是对每个端点进行预热,以便它们可以进行JIT编辑并准备就绪,我发现没有什么比预热脚本更好的了,因为该脚本具有要调用的所有端点列表,这不是完美的方法,但是它作品.因此,每次进行部署或重新启动时,此操作都会自动运行,并且您的首次通话不会受到伤害. 看看

This bit me as well. "Always On" will only make automated calls to your service root - think about slapping the process every time so it won't fall sleep.. We don't use this in our PROD services, we rather have an Azure Availability Test invoking a Ping() endpoint every 5 mins - two birdies, one stone. Besides, AlwaysOn will generate 404 errors in App Insights if you don't have anything in the root.. A totally different thing is warming up each one of the endpoints so they could get JIT-ed and ready, and I have not found anything better than a warm-up script with the whole list of endpoints to call, it is not perfect but it works. So every time you do a deployment o do a restart this will automatically run and your first calls won't be hurt. Have a look at this article. I hope this helps

这篇关于发布Azure Web App之后的第一个请求变慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆