简体   繁体   English

在天蓝色实例中要求自动缩放后过早

[英]After autoscale in azure instance is requested too soon

Currently I am facing the problem that if I my scaling out rule in applied and new instance is my web app is created it gets request too soon. 当前,我面临的问题是,如果我在应用中使用向外扩展规则并且创建了新实例是我的Web应用程序,那么它会过早收到请求。 By that I mean that it is not finished its initialization. 我的意思是说它还没有完成初始化。

I have read that there is a solution which I can add to my OnStart method. 我已经读过,有一种解决方案可以添加到我的OnStart方法中。 It will be checking instance health and allow requests only after it will pass specified health test. 它将检查实例运行状况,并仅在通过指定的运行状况测试之后才允许请求。

But I am wondering if there is a way to add such a check somewhere in azure. 但是我想知道是否有办法在天蓝色的某处添加这样的支票。 In case there is, please share it with me. 如果有,请与我分享。

In case you know any other way to check instance's health you are more than welcome to share it with me. 如果您知道任何其他检查实例健康状况的方法,非常欢迎与我分享。

Thank you. 谢谢。

You can use ApplicationInitialization setting in the web.config file. 您可以在web.config文件中使用ApplicationInitialization设置。

you'll need to add something like this: 您需要添加以下内容:

<applicationInitialization doAppInitAfterRestart="true" skipManagedModules="true">
    <add initializationPage="/" />
    <add initializationPage="/User" />
</applicationInitialization>

Every time your application starts, this can be because of a new worker coming online (horizontal scaling) or even just a cold start caused by a new deployment, config change etc... the ApplicationInitialization will be executed to warm up the site before accepting requests on that worker. 每次您的应用程序启动时,这可能是由于新工作人员上线(水平扩展),或者仅仅是由于新的部署,配置更改等导致的冷启动。在接受之前,将执行ApplicationInitialization来预热站点对那个工人的要求。

You can read more about this here: http://ruslany.net/2015/09/how-to-warm-up-azure-web-app-during-deployment-slots-swap/ 您可以在此处了解更多信息: http : //ruslany.net/2015/09/how-to-warm-up-azure-web-app-during-deployment-slots-swap/

Even though that post is talking about using this for warming up a site when doing a swap operation, it also applies to cold starts, and scale outs. 即使该帖子正在谈论在执行交换操作时使用它来预热站点,但它也适用于冷启动和横向扩展。

Reference: How can I make sure a new autoscaled Azure App Service instance is warm before it handles traffic? 参考: 如何在处理流量之前确保新的自动缩放的Azure App Service实例处于预热状态?

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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