title: Logic app and service bus queue not scaling logic app run-instances properly
body: <p>Hi i have a performance issue regarding Logic Apps and a Azure Service bus queue.</p>
  <p>So i have a logic app looking like this:</p>
  <p><a href="https://i.stack.imgur.com/s6P57.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s6P57.png" alt="enter image description here" /></a></p>
  <p>(NOTE: The delay is there to simulate a bunch of connectors/actions that take about 2 seconds to run, also i'm using lock tokens and also session IDs to complete messages and Close sessions)</p>
  <p>Its polling the service bus every second for high throughput with a peak-lock
  because my service bus queue uses sessions to enable FIFO Ordering in my flow.
  So what i'm doing is, sending about 2000 messages with different session-IDs and also some that are alike depending on the message as they relate to each other sometimes (hens the fifo) to my service bus.</p>
  <p>Enabling the Logic app after all the messages are in the Queue, my Logic App only processes 10 messages at a time. In other words it only scales up to 10 runs simultaneously.</p>
  <p>This is far to slow, as those 2000 messages takes about 15 minutes to process.
  That's about 2-4 seconds per run, 10 runs at a time depending on the last 2 connectors that can take up to 1 second each to complete the message and close the session.</p>
  <p>What i have done to try to solve this by trying for example:</p>
  <ul>
  <li><p>Running the <strong>&quot;When one or more messages are received in queue (peak-lock)&quot;</strong> instead with message count delivery bumped up to 175 (max value). This results still in only one message getting polled, guessing this has to do with the sessions enabled for the queue.</p>
  </li>
  <li><p>Turned on &quot;High Throughput&quot; on the logic app, resulting in only up to 10 instances running simultaneously anyway, sometimes even fewer.</p>
  </li>
  <li><p>Turned off (and even turned on with max value defined) the switch for &quot;Concurrency Control&quot; on the trigger for the logic app. Still same results.</p>
  </li>
  <li><p>Scaled up the service bus to standard tier, still no luck.</p>
  </li>
  <li><p>Tried to clone the same logic app up to 5 times running them in parallell, still same result.</p>
  </li>
  </ul>
  <p>and much more..</p>
  <p>(Worth mentioning, the messages aren't bigger than 1,5kb - 1,8kb)</p>
  <p>What am i missing? I can't think of any other configuration to change, or any other ideas using this combination of logic app and session enabled service bus queues to try next. Should i maybe even upgrade the service bus to premium? I didn't think it was worth it because i haven't met the limits for the standard tier yet.</p>
  <p>If i forgot to post any useful data please tell me and i will edit the question.</p>
  <p><strong>EDIT:</strong></p>
  <p><strong>2018-04-06 10:00</strong></p>
  <p>I how now tried a type of “Sequential Convoy” type of solution which yielded in even worse results:</p>
  <p>I followed this guide with some modifications: <a href="https://blogs.msdn.microsoft.com/logicapps/2017/05/02/in-order-delivery-of-correlated-messages-in-logic-apps-by-using-service-bus-sessions/" rel="nofollow noreferrer">Sequential Convoy Guide</a></p>
  <p>The modification i did was putting a &quot;for each&quot; loop instead of a &quot;do until&quot;.
  The thing with this solution was that it took the &quot;get all messages in queue&quot; action about 30 seconds to search for a message in the queue containing the defined session ID, which is way to much. This also resulted in a weird behavior which made the logic app to scale less parallel runs too.</p>
  <p><a href="https://i.stack.imgur.com/pHOu9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pHOu9.png" alt="enter image description here" /></a></p>
  <p><strong>2018-04-06 16:00</strong></p>
  <p>Another test i tried now was trying to skip the service bus to test the instance scaling of the logic app, and sure enough posting directly from the API to the Logic app by the Http Post trigger in logic app, the logic app runs a lot more instances that with the service bus in between.</p>
  <p>Which means that it is the service bus queue limiting the amount of instances being run by the logic app.</p>
  <p>I cant find anything that fixes this problem, even by trying do clone the logic app to multiple amounts pulling from the same queue...</p>
  <p>Any ideas on this?</p>