Azure函数不使用可用主机实例

发布于 2025-02-14 00:02:27 字数 1180 浏览 0 评论 0原文

风景:

  • 我们使用Python 3.x编码EventHub触发函数。
  • 所有资源均使用VNET集成连接。 (所有资源下 同一子网)
  • 我们正在使用用户分配托管身份以允许 访问资源。
  • Azure功能具有ASP Premium Plan EventHub标准标准,带有32个分区

cpu利用率



。 一段时间后,该功能正在运行,我们期望该功能根据我们配置的指标(例如CPU AVG)扩展。但是我们意识到,我们仍然有一些闲置的实例,并且功能没有使该实例主机用于执行其代码。

https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs/event-hubs-event-processor-host-parost#parttion-partition-houlthip--tracking:adxt=976- 2C%20 eact eacte dem 20 host%20Acquires 我们可以看到,如果您有一个配置了32分区您的Azure功能将扩展到最大可能的主机实例,以便参加来自EventHub的负载。但是在我们的情况下,Azure函数并没有扩展,即使我们已经有10个主机,函数仅使用2个主机,以供出现。如果我们查看指标并按实例拆分图表,我们可以使用100%的CPU和其他未使用的人看到2个主机的行为。

在研究了一点之后,我们意识到了检查功能的存储帐户,这些存储帐户只有两个所有权甚至创建了一个带有32个分区的EventHub,还有32个分区和更多3个主机实例变暖和空闲。 重新启动功能时,解决了问题。

Scenery:

  • We have an eventhub trigger function coded using python 3.x .
  • All resources are connected using VNET integration. (All resources under
    the same subnet)
  • We are using User Assign Managed Identity to allow
    access to resources.
  • Azure Function with ASP Premium Plan EventHub Standard with 32 partitions

CPU utilization details



We are facing a weird behavior.
After some time that function is running, we are expecting the function to scale out based on metrics that we had configured, like cpu avg. But we realized that we still have some instances idle and function don't get that instance host to use to execute it's code.

Following the MS documentation to https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-event-processor-host#partition-ownership-tracking:~:text=976-,Here,-%2C%20each%20host%20acquires we can see that if you have a eventhub configured with 32 partitions your Azure Function will scale out to max possible Hosts Instances in order to attend the load that came from eventhub. But in our case the Azure function does not scale out, and even with we have 10 hosts already the function use just 2 hosts, for exemple. If we look at the metrics and split the chart by instances we can see the behavior with 2 hosts using 100% of you CPU and the others unused.

After investigating a bit we realized checking function's storage account that have just two ownership created even we having one eventhub with 32 partitions and more 3 hosts instances warmed and idle.
The problem is solved when function is restarted.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日暮斜阳 2025-02-21 00:02:27

如果比例控制器确定当前处理事件的实例无法处理负载,无论预热或最低实例如何,高级托管计划Azure函数将使用其他实例。

因此,即使您有5个预热和最低限度,它也会开始将所有事件发送到一个实例,然后一旦一个人变得越来越负担,然后将平衡加载给其他事件。

这就是比例控制器平衡负载的方式。

查看CPU利用率时,平均CPU利用率保持在67%&只有57%的时间,只有在超过70%并保留一段时间时才将事件进行路由以利用其他实例。

If the scale controller determines that the instance(s) currently handling the events are unable to handle the load, regardless of pre-warmed or minimum instances, Premium hosting plan Azure Functions will use the other instances.

So, even if you have 5 in pre-warmed and minimum, it will begin sending all events to one instance and then load balance to the others once that one becomes overburdened.

This is how the scale controller balances the load.

When looking at the CPU utilization, the average CPU utilization remains at 67% & 57% respectively, only when they exceed 70% and remain for a period of time will events be routed to utilize other instances.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文