简体   繁体   English

Azure Function Queue Trigger 远远落后

[英]Azure Function Queue Trigger falling way behind

I'm working on a demo for azure functions using queue triggers.我正在为使用队列触发器的 azure 函数做一个演示。 I created a recursive Sudoku solver to show how to take depth first search and convert to using queued recursion.我创建了一个递归数独求解器来展示如何进行深度优先搜索并转换为使用排队递归。 The code is on github .代码在github 上

I was expecting it to scale out and process an insane number of messages per second, but it is barely processing 30/s.我期待它能够横向扩展并每秒处理大量的消息,但它几乎没有处理 30/s。 The queue is filling up and the utilization seems minimal.队列正在填满,利用率似乎很小。

最低利用率

How can I get better performance from this?我怎样才能从中获得更好的性能? I tried increasing the batch size in the host.json, but didn't seem to help.我尝试增加 host.json 中的批处理大小,但似乎没有帮助。 I have over 200k messages in the queue and it's growing.我在队列中有超过20 万条消息,而且还在增长。

Update 1 I tried setting the host.json file as更新 1我尝试将 host.json 文件设置为

{
  "queues": {
    "visibilityTimeout": "00:00:10",
    "batchSize": 32,
    "maxDequeueCount": 5,
    "newBatchThreshold": 100
  }
}

but request per second remained the same.但每秒请求保持不变。

I deployed the same function to another instance, but tied it to S4 service plan.我将相同的功能部署到另一个实例,但将其绑定到 S4 服务计划。 This is able to process about 64 requests per second, but still seems slow.这能够每秒处理大约 64 个请求,但看起来仍然很慢。

I can serial process the messages locally way faster than this.我可以比这更快地在本地串行处理消息。

Update 2更新 2

I scaled the S4 to 10 instances and each instance is handling about 60-70 requests per second.我将 S4 扩展到 10 个实例,每个实例每秒处理大约 60-70 个请求。 But that's insanely expensive to still not be able to process as fast as I can with a single core locally.但是,仍然无法像我在本地使用单个内核那样快速处理,这是非常昂贵的。 The queue used with the service plan functions has 500k messages piled up.与服务计划功能一起使用的队列堆积了500k条消息。

Azure functions do not listen for an item to be added to a queue, they actually pole the queue using a polling algorithm which you can over ride with the maxPollingInterval property. Azure 函数不会侦听要添加到队列中的项目,它们实际上使用轮询算法来排队队列,您可以使用 maxPollingInterval 属性覆盖该算法。 Adding "maxPollingInterval": "00:00:01" to the options you have already mentioned above should solve your problem.将 "maxPollingInterval": "00:00:01" 添加到您上面已经提到的选项中应该可以解决您的问题。

maxPollingInterval azure documentaiton maxPollingInterval 天蓝色文档

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

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