HowTo — Throttle azure function

Tarun Garg
1 min readMar 25, 2021

Throttling is a proactive step the system takes to safeguard the overall environment. Although the logic app is serverless it has boundaries after which it will throttle your executions. More details can be found at the link [ Ref].

Similarly, downstream systems can have limitations. In one of my recent projects, I need to limit the downstream API calls to a max of 2–3 calls per second, and upstream can potentially call AzureFunction 5000 times within 1 minute.

Although Azure Functions are scalable to handle 5k load, we are getting timeouts due to downstream limitations. I cannot change the source (S1)or destination(D1) behavior since those are third-party systems. The only good thing in this case source (S1) behavior is like fire-and-forget type, source ( S1) is concerned only with the successful delivery of the message.

We can get this implemented using two settings in FunctionApp2 throttle config:

host.json update

“extensions”: {
“queues”: {
“batchSize”: 1,
“maxDequeueCount”: 1,
“newBatchThreshold”: 1
}
}

AzureFunction Config

WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT = 1

Ref

You have to perform some tests using a combination of the above values and find the ideal settings for you.

--

--