Azure Function Queue Trigger falling way behind

Viewed 1255

I'm working on a demo for azure functions using queue triggers. 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.

I was expecting it to scale out and process an insane number of messages per second, but it is barely processing 30/s. The queue is filling up and the utilization seems minimal.

Minimal utilization

How can I get better performance from this? I tried increasing the batch size in the host.json, but didn't seem to help. I have over 200k messages in the queue and it's growing.

Update 1 I tried setting the host.json file as

{
  "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. This is able to process about 64 requests per second, but still seems slow.

I can serial process the messages locally way faster than this.

Update 2

I scaled the S4 to 10 instances and each instance is handling about 60-70 requests per second. 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.

1 Answers

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. Adding "maxPollingInterval": "00:00:01" to the options you have already mentioned above should solve your problem.

maxPollingInterval azure documentaiton

Related