gpt4 book ai didi

azure - 如何扩展 Azure Webjobs

转载 作者:行者123 更新时间:2023-12-02 20:55:18 27 4
gpt4 key购买 nike

我知道 webjob 随 webapp 一起扩展,即如果我的 webapp 在 5 个实例上运行,那么 webjobs 也将在 5 个实例上运行。 我只是想知道是否有办法在网站的每个实例中拥有多个 webjob 实例。

注意:我已经设置了 JobHostConfiguration.QueuesConfiguration.BatchSize = 32 的最大值。

现在,我的 Web 应用程序正在 1 个实例上运行。 Webjobs 正在同时处理 32 个。 我的目标是同时处理 3*32 = 96 个。

实现此目标的一种可能方法是部署相同的 webjobs 3 次(为 webJobName 属性设置不同的名称),但我不确定这是否是一个好的做法。请给我指出适当的文档。

  • config.Queues.NewBatchThreshold 表示什么?

  • config.Queues.NewBatchThreshold 的默认值是多少?

  • 对于队列处理,config.Queues.NewBatchThreshold 的建议值应该是多少?

  • 最佳答案

    复制乔恩的回答 https://github.com/Azure/azure-webjobs-sdk/issues/628 :

    The NewBatchThreshold is the number of messages to have left to process in the batch before the SDK refreshes the batch.

    For example, if your batch size is 20 and NewBatchThreshold is 5, the SDK will grab 20 messages off the queue each time, pass them to your code for you to process them one by one, then when it gets down to the last 5 unprocessed messages (so you've processed 15) it will grab the next 20. See here under "Parallel execution"

    By default the NewBatchThreshold is half of BatchSize (see source code) which is why you are seeing a value of 0 for a batch size of 1.

    请注意,我们希望让这不那么困惑,根据 this issue我刚刚打开。

    关于azure - 如何扩展 Azure Webjobs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37740341/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com