Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scaling # of parallel instances for a queue-triggered azure function

I’m trying to better understand how azure function scaling works under a consumption plan.

I have been testing an app that inserts 1000 messages in a storage queue, which triggers an azure function written in C#.

The function downloads a file and performs some processing on it. It takes around 20 seconds to complete each request.

Running the function on a consumption plan, I am seeing it take upwards of 10 minutes to fully drain the queue. Configuring each function instance to process only one queue message at a time, I would have expected 1000 instances to be launched for 1000 messages, but that does not appear to be the case.

Using the Live Metrics Stream on App Insights, I never saw the # of running instances go over 30.

Is this sort of throughput expected? For reference, here is my queue configuration in the function’s host.json:

 "queues": {
    "maxPollingInterval": 2000,
    "visibilityTimeout": "00:00:30",
    "batchSize": 1,
    "maxDequeueCount": 5,
    "newBatchThreshold": 1
  }

Any information that could be provided on the scaling capabilities, or suggestions to achieve better throughput here would be appreciated.

like image 347
Arjun Garg Avatar asked Aug 31 '17 22:08

Arjun Garg


People also ask

What is the purpose of scaling?

Scaling is a common dental procedure for patients with gum disease. This is a type of dental cleaning that reaches below the gumline to remove plaque buildup. The process of scaling and root planing the teeth is often referred to as a deep cleaning.

Is teeth scaling painful?

Is deep cleaning painful? Teeth scaling and root planing can cause some discomfort, so you'll receive a topical or local anesthetic to numb your gums. You can expect some sensitivity after your treatment. Your gums might swell, and you might have minor bleeding, too.

What is polishing and scaling?

Scaling refers to the removal of plaque and calculus (the white or yellow hard deposits that accumulate on your teeth and is not removable by routine brushing). Polishing refers to the removal of stains and very small particles of calculus.

Is teeth scaling necessary?

Scaling and root planing procedures are often necessary to improve the overall health of a patient's gums. Good gum health is essential to good mouth health, which means patients need to undergo regular dental cleanings.


1 Answers

Firstly, we can specify the number of queue messages to retrieve and process in parallel (per job function) by setting batchSize in host.json. If you want only single queue message to be retrieved and processed, as you did, you can set batchSize to 1.

Besides, when we're using a Consumption plan, instances of the Azure Functions host are dynamically added and removed based on the number of incoming events. During it scales, some queue messages have be processed and removed from queue, so it does not scale to 1000 instances. Please refer to Azure Functions Consumption and how it works for detailed information.

like image 52
Fei Han Avatar answered Sep 20 '22 16:09

Fei Han