Cloud Service Always On Not working

家住魔仙堡 提交于 2019-12-13 21:57:23

问题


I have a Web Api service running in Cloud Services in Azure. I noticed like many have here that the first call to the service seems to take forever (almost 1 minute) and subsequent calls are normal. I looked around and came about a few resolutions, one being adding a startup script to the Role Startup of the Deployment

REM *** Prevent the IIS app pools from shutting down due to being idle.
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00

REM *** Prevent IIS app pool recycles from recycling on the default schedule of 1740 minutes (29 hours).
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.recycling.periodicRestart.time:00:00:00

As well as setting the AppPool's Start Mode Property to AlwaysOn. After making these changes, I am still seeing latency issues when the Cloud Service is initially deployed and the web service is hit. So what could be going on here? Do I need to write a script to "warm up" the web service on startup of the Cloud Service?


回答1:


I had a similar issue, Isaac, and as you suggest, added several calls to the API after a new deployment (automated) so production users would not experience the delay.

I'm also curious if there is a better way.




回答2:


You can use staging environments for zero downtime deployments. Deploy your app to staging slot and warm up there. When you feel ready, just swap. Azure will drain current connections and change the endpoints smoothly. Check this.




回答3:


I use an Azure Scheduler Job that does a GET on my url every 5 minutes. You can schedule it however often you need. It also has auto retry on by default, and you can create actions for failure as well.



来源:https://stackoverflow.com/questions/34404801/cloud-service-always-on-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!