【问题标题】:Understanding Azure Functions HttpTrigger scaling algorithm了解 Azure Functions HttpTrigger 缩放算法
【发布时间】:2021-09-10 07:47:15
【问题描述】:

我试图了解 Http 触发函数如何决定何时缩放。

我发现队列触发器使用了 IScaleMonitor 实现。他们在这里:RabbitMQBlob triggerEvent hub 1Event hub 2KafkaService bus 1Service bus 2Cosmos DBStorage queue

但我找不到任何适用于 HttpTriggers 的代码。有谁知道在哪里可以找到 http 缩放算法?

【问题讨论】:

    标签: c# azure azure-functions


    【解决方案1】:

    使用 HTTP 触发器的 Azure 函数根据 host.json 中 maxConcurrentRequests 的设置进行缩放:

    {
      "extensions": {
        "http": {
          "maxConcurrentRequests": 100,
        }
      }
    }
    

    文档在这里:Azure Functions HTTP output bindings

    使用服务总线的 Azure 函数根据 host.json 文件中 maxConcurrentCalls 的设置进行缩放。

    将最大并发调用数设置为 10 的示例 host.json 文件:

    {
      "extensions": {
        "serviceBus": {
          "messageHandlerOptions": {
            "maxConcurrentCalls": 10
          }
        }
      }
    }
    

    文档在这里:Azure Service Bus bindings for Azure Functions

    【讨论】:

    • 感谢您的回答,bun 不幸的是我测试了 maxConcurrentRequests 并且找不到该参数以某种方式影响缩放的任何场景。我的测试负载配置文件是 500 rps 和 100ms 请求持续时间我尝试了以下配置:(maxConcurrentRequests,dynamicThrottlesEnabled):(1,true),(1,false),(100000,true),(100000,false)。在每种情况下,我的测试应用都扩展到 5 个实例。
    • 此外,我发现只有当参数 dynamicThrottlesEnabled 为真时才会考虑参数 maxConcurrentRequests 和 maxOutstandingRequests。他们唯一影响的就是在不满足条件时返回 429。证明:github.com/Azure/azure-functions-host/blob/… 感谢您的帮助,但我仍在努力找出 Http 触发器的规模。
    猜你喜欢
    • 2021-04-20
    • 2017-11-20
    • 2021-02-10
    • 2021-12-26
    • 1970-01-01
    • 2020-05-30
    • 1970-01-01
    • 1970-01-01
    • 2021-01-15
    相关资源
    最近更新 更多