How to limit the number of concurrent Logic Apps instances

Overview

We recommend to use Logic Apps for integration. Virto Commerce API Swagger Schema can be easily imported into Logic Apps. Also, Logic App supports a lot of predefined connectors and protocols. So, you can create integration between Virto Commerce and your ERP system from scratch to ready to use solution in a few hours.

But we see that sometimes concurrent Logic Apps instances can be head pain for IT staff.

The main reason to limit the number of concurrent Logic Apps instances, is to avoid that Virto Commerce is overwhelmed by too many requests. Via this concurrency control, you can throttle the outbound connectivity to those backend systems, by limiting the number of parallel connections.

Change trigger concurrency

By default, logic app workflow instances all run at the same time (concurrently or in parallel). This behaviour means that each trigger instance fires before the previously active workflow instance finish running.

However, the number of concurrently running instances has a default limit. When the number of concurrently running workflow instances reaches this limit, any other new instances must wait to run. This limit helps control the number of requests that backend systems receive.

To change the default limit, you can use either the Code View Editor or Logic Apps Designer because changing the concurrency setting through the designer adds or updates the runtimeConfiguration.concurrency.runs property in the underlying trigger definition and vice versa. This property controls the maximum number of workflow instances that can run in parallel.

Edit in Logic Apps Designer

  1. In the trigger’s upper-right corner, select the ellipses ( … ) button, and then select Settings.
  2. Under Concurrency Control , set Limit to On .
  3. Drag the Degree of Parallelism slider to the number 5.

Here are some considerations for when you want to enable concurrency control:

  • When concurrency is enabled, the SplitOn limit is significantly reduced for debatching arrays. If the number of items exceeds this limit, the SplitOn capability is disabled.
  • While concurrency is enabled, a long-running logic app instance might cause new logic app instances to enter a waiting state. This state prevents Azure Logic Apps from creating new instances and happens even when the number of concurrent runs is less than the specified maximum number of concurrent runs.

Run your logic app sequentially

To run your logic app sequentially, set the trigger’s concurrency to 1 either by using the code view editor or the designer.

"<trigger-name>": {
   "type": "<trigger-name>",
   "recurrence": {
      "frequency": "<time-unit>",
      "interval": <number-of-time-units>,
   },
   "runtimeConfiguration": {
      "concurrency": {
         "runs": 1
      }
   }
}

Or

Set the operationOptions property to SingleInstance:

"<trigger-name>": {
   "type": "<trigger-name>",
   "recurrence": {
      "frequency": "<time-unit>",
      "interval": <number-of-time-units>,
   },
   "operationOptions": "SingleInstance"
}

For more information, see Runtime configuration settings and Operation options.

2 Likes