即使启用了自动交换,Azure Function部署也会导致短暂的503错误 [英] Azure Function deployments cause brief 503 errors even when auto swap is turned on

查看:44
本文介绍了即使启用了自动交换,Azure Function部署也会导致短暂的503错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过VS发布窗口将更新部署到我的Function应用程序.我设置了一个启用自动交换功能的部署插槽.我通过VS进行的更新即将发布.问题是,发布成功之后,当我测试API端点时,我短暂地收到503错误.我的印象是自动交换是无缝的,最终用户不会遇到这种中断.我想念什么吗?如何使我的部署不为用户所关注?

I'm deploying updates to my Function app through the VS publish window. I set up a deployment slot with auto swap turned on. My updates through VS are going to the slot. The problem is, right after the publish is successful and when I test my API endpoints, I briefly receive 503 errors. I was under the impression that auto swap was seamless and end-users would not experience such interruptions. Am I missing something? How can I make my deployments unnoticeable to the users?

推荐答案

切换到类似API Management或Traffic Manager的选项显然是一种选择,但是插槽的设计完全可以满足您的要求,它们应该以您期望的方式工作.

Switching to something like API Management or Traffic Manager is obviously an option, but slots are designed to do exactly what you want, and they should work the way you expect.

我对此进行了调查.不幸的是,我可以重制您的问题,这令我感到惊讶.在将Azure功能与插槽一起使用时,有些事情感觉有些不对劲,因此在表底下可能有些怪异.

I looked into this a bit. Unfortunately, I can reproduce your issue, which suprised me. A few things feel a bit off when using Azure Functions with slots, so maybe there is some weirdness under the covers.

官方文档没有提任何与此有关的东西,恰恰相反:

The official documentation does not mention anything about this however, quite the opposite:

流量重定向是无缝的;没有因交换而丢弃的请求.

如果函数在交换期间正在运行,则执行将继续,并且下一个触发器将路由到交换的应用程序实例.

If a function is running during a swap, execution continues and the next triggers are routed to the swapped app instance.

您甚至不需要使用自动交换".只需发布到两个插槽并手动交换插槽即可.观察响应时,可以看到以下模式:

You don't even need to use Auto Swap. Just publish to both slots and swap the slots manually. When observing the responses, the following pattern can be seen:

  1. 旧代码的响应
  2. 新代码的响应
  3. 503个错误,持续10秒钟左右
  4. 请求速度降低
  5. 新代码的响应

我尝试过:

  • AppService计划和消费计划
  • 打开/关闭AAR关联性
  • Azure Function V2和V3运行时

对我来说,这似乎是个错误.我建议您创建一个支持案例,也许在 Github 上遇到问题.如果我发现接下来几天的时间,我可能会自己这样做.另请参见此问题:

This seems like a bug to me. I would suggest you create a support case and maybe an issue at Github. I might do so myself if I find the time in the next few days. See also this Issue:

https://github.com/Azure/Azure-Functions/issues/862

edit:链接的GitHub问题以及中篇文章指出,您可以将 WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG 设置为 1 ,这将有助于解决503错误.这是记录在AppService中非常深的行为

edit: the linked GitHub issue and also the medium article mentioned by Ron point out that you can set WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG to 1 and this should help with the 503 errors. It is a documented behavior very deep in the AppService docs. Why it is not mentioned for Azure Functions eludes me.

这篇关于即使启用了自动交换,Azure Function部署也会导致短暂的503错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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