简体   繁体   English

如何扩展Azure Webjobs

[英]How to Scale Azure Webjobs

I know that webjob scales with webapp ie if my webapp is running on 5 instances then webjobs will run on 5 instances as well. 我知道webjob与webapp一起扩展,即如果我的webapp在5个实例上运行,那么webjobs也将在5个实例上运行。 I just want to know if there is a way of having multiple instances of the webjob within each instance of the website. 我只想知道是否有一种方法可以在网站的每个实例中拥有多个webjob实例。

Note: I have max the value of JobHostConfiguration.QueuesConfiguration.BatchSize = 32 already. 注意:我已经有最大值JobHostConfiguration.QueuesConfiguration.BatchSize = 32

Now, my webapp is running on 1 instance. 现在,我的webapp正在运行1个实例。 Webjobs is processing 32 concurrently. Webjobs同时处理32个。 My goal is to process 3*32 = 96 concurrently. 我的目标是同时处理3 * 32 = 96。

One possible way to achieve this goal could be deploying the same webjobs 3 times(setting a different name for webJobName property), but i am not sure if this will be a good practice. 实现此目标的一种可能方法是部署相同的webjobs 3次(为webJobName属性设置不同的名称),但我不确定这是否是一个好的做法。 Please point me the appropriate documentation. 请指出相应的文件。

  1. What config.Queues.NewBatchThreshold indicate? config.Queues.NewBatchThreshold表示什么?

  2. What is the default value for config.Queues.NewBatchThreshold ? config.Queues.NewBatchThreshold的默认值是什么

  3. For queue processing what should be the recommend value for config.Queues.NewBatchThreshold ? 对于队列处理,应该是config.Queues.NewBatchThreshold的推荐值?

Copying Jon's answer from https://github.com/Azure/azure-webjobs-sdk/issues/628 : https://github.com/Azure/azure-webjobs-sdk/issues/628复制Jon的答案:

The NewBatchThreshold is the number of messages to have left to process in the batch before the SDK refreshes the batch. NewBatchThreshold是SDK刷新批处理之前要在批处理中处理的消息数。

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" 例如,如果您的批处理大小为20且NewBatchThreshold为5,则SDK每次会从队列中抓取20条消息,将它们传递给您的代码,以便您逐个处理它们,然后当它下载到最后5个未处理的消息时消息(所以你已经处理了15)它会抓住下一个20. “并行执行”

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. 默认情况下,NewBatchThreshold是BatchSize的一半( 请参阅源代码 ),这就是批量大小为1时看到值为0的原因。

Note that we'd like to make this less confusing, per this issue I just opended. 请注意,根据我刚刚公开的这个问题 ,我们希望减少一点。

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

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