Azure Logic App - Limit concurrent calls

One of the nicest things about Logic Apps is how seamless and fast their execution goes and how little you have to worry about managing concurrency and execution times,

until you do…

For the first time in a long time of writing Logic Apps I got in trouble with how scalable Logic Apps are, not once… but twice.

In one case I built a data-ingestion pipeline where the trigger was an FTP location and the output was a CosmosDB account. The process involves multiple files that come in once a day and processing can take place in the off-hours. The CosmosDB instance, sits at a low-med scale since it’s not serving a huge amount of traffic on a regular basis. However, when the trigger runs on the logic app, and the 10 files of new content are detected, the logic app hurries to do its job as quickly and efficiently as possible and spins up 10 jobs and the flood gates open for the poor CosmosDB account.

The other situation, writing a quick and dirty WebHook for an Azure DevOps build - yes, there might be better solutions out there, but I was in a pinch, and the Logic Apps Azure DevOps connector works like a charm. With a little logic to check if builds are in progress or queued, and making sure we’re not queueing multiple builds of the same type, managed to get a nice model, in theory. However, what happens if 3-4-5 calls are made in very quick succession to the same build definition? The Logic App will again spin up as quickly as possible and try to run as many jobs as it can in parallel, effectively trying to execute all builds in parallel so that the magic logic does not have time to check and only queue necessary builds.

To both these problems, the same solution applies - limiting the number of concurrent runs from the Trigger Settings:

You can achieve that from the Designer tab - just click the cog on the trigger box then select the option.

… or you can do it from an arm template if you’re deploying your app programmatically

"runtimeConfiguration": {
"concurrency": {
"runs": 1
Share Comments