Blog Post

Azure Integration Services Blog
5 MIN READ

Scaling Logic Apps Standard – Sustained Message Processing System

ChenshuZhu's avatar
ChenshuZhu
Icon for Microsoft rankMicrosoft
Nov 26, 2024

In this blog, we will see how Logic App standard can be used to process high throughput message data that can facilitate the decoupling of applications and services.

In the previous blog of this blog post series, we discussed how Logic App standard can be used to process high throughput event data at a sustained rate over long periods of time. In this blog, we will see how Logic App standard can be used to process high throughput message data that can facilitate the decoupling of applications and services. We simulate a real-life use case where messages are sent to a Service Bus queue at a sustained rate for processing, and we use a templated Logic App workflow to process the messages in real-time. The business logic in the templated workflow can be easily replaced by the customer to actions that encompass their unique processing of the relevant messaging information. To better showcase the message processing capabilities, we will discuss two scaling capabilities, one for vertical scaling (varying the performance of service plans), and another horizontal scaling (varying the number of service plan instances). 

Vertical scaling capabilities of the Logic App Standard with Built-In Service Bus Connector 

In this section, we will investigate the vertical scaling capabilities of the Logic App Service Bus connector, conducting experiments to find the maximum message throughput supported by each of the standard Logic App SKUs from WS1 to WS3.  

The workflow uses the Service Bus built-in trigger, so the messages are promptly picked up and are processed in the run at par with ingress rate. like the one shown below - available at our Template Gallery. Customers can replace the Business Logic and Compensation Logic to handle their business scenarios.  

 

Template workflow named "Azure Service Bus: Get message from a queue - Peek lock abandon pattern"

For this investigation, we used the out-of-the-box Logic Apps Standard configuration for scaling: 

  • 1 always ready instance  
  • 20 maximum burst instances 

We also used the default trigger batch size of 50. 

Experiment Methodology 

For each experiment we selected one of the available SKUs (WS1, WS2, WS3), and supplied a steady influx of X messages per minute to the connected Service Bus queue in one experiment. We conduct multiple experiments for each SKU and gradually increase X until the Logic App cannot process all the messages immediately.  

For each experiment, we pushed enough (1 million) messages in total to the queue to ensure that each workflow reaches a steady state processing rate with its maximum scaling.  

Environment Configuration 

The experiment setup is summarized in the table below: 

 Tests setup 

Single Stamp Logic App 

Number of workflows   

1 Templated 

Triggers   

Service Bus  

Trigger batch size 

50 

Actions   

Service Bus, Scope, Condition, Compose 

Number of storage accounts   

1 

Prewarmed instances   

1 

Max scale settings   

20 

Message size 

1 KB 

Service Bus queue max size 

2 GB 

Service Bus queue message lock duration 

5 minutes 

Service Bus queue message max delivery count 

10 

Experiment results 

We summarize the experiment results in the table below. If the default maximum scaling of 20 instances is adopted, then the throughput we measured here serves as a good reference for the upper bound of message processing powers: 

WS Plan 

Message Throughput 

Time to process 1M messages 

WS1 

9000 messages/minute 

120 minutes 

WS2 

19000 messages/minute 

60 minutes 

WS3 

24000 messages/minute 

50 minutes 

In all the experiments, the Logic App scaled out to 20 instances at steady state. 

📝 Complex business logic, which requires more actions and/or longer processing times, can change those values. 

Findings 

Understand the scaling and bottlenecks 

In the vertical scaling experiments, we limited the maximum instance count to 20. Under this setting, we sometimes observe "dead-letter" messages being generated.  

With Service Bus, messages become "dead-letters" if they are not processed within the lock duration for all delivery attempts. This means that the workflow takes more than 5 minutes to complete the scope/business logic for some messages. The root cause is that the Service Bus trigger fetches messages faster than the workflow actions can process them.  

As we can see in the following figure, the Service Bus trigger can fetch as much as 60k messages per minute, but the workflow can only process less than 30k messages per minute. 

Recommendations 

We recommend going with the default scaling settings if your workload is well below the published message throughput and increase the maximum burst when a heavier workload is expected. 

Horizontal scaling capabilities of the Logic App Service Bus connector 

In this section, we probe into the horizontal scaling of Logic App message handling capabilities with varying instance counts. We conduct experiments on the most performant and widely used WS3 SKU.  

Experiment Methodology 

For each experiment we varied the number of pre-warmed instances and maximum burst instances and supplied a steady influx of X messages per minute to the connected Service Bus queue, gradually increase X until the Logic App cannot process all the messages immediately.  

We push enough (4 million) messages to the queue for each experiment to ensure that each workflow reaches a steady state processing rate. 

Environment configuration 

The experiment setup is summarized in the table below: 

 Tests setup 

Multi Stamp Logic App 

Number of workflows   

1 Templated 

Triggers   

Service Bus  

Trigger batch size 

50 

Actions   

Service Bus, Scope, Condition, Compose 

Number of storage accounts   

3 

Message size 

1 KB 

Service Bus queue max size 

4 GB 

Service Bus queue message lock duration 

5 minutes 

WS Plan 

WS3 

Service Bus queue message max delivery count 

10 

Experiment results 

The experiment results are summarized in the table below: 

Prewarmed Instances 

Max Burst Instances 

Message Throughput 

1 

20 

24000 messages/minute 

1 

60 

65000 messages/minute 

5 

60 

65000 messages/minute 

10 

60 

65000 messages/minute 

10 

100 

85000 messages/minute 

In all the experiments, the Logic App scaled out to the maximum burst instance allowed at steady state. 

Editor's Note: The actual business logic can affect the number of machines the app scales out to. The performance might also vary based on the complexity of the workflow logic.

Findings 

Understand the scaling and bottlenecks 

In the horizontal scaling experiments, when the max burst instances count is 60 or above, we no longer observe "dead-letters" being generated. In these cases, the Service Bus trigger can only fetch messages as fast as the workflow actions can process them. As we can observe in the following figure, all messages are processed immediately after they are fetched.  

Does the scaling speed affect the workload?    

As we can see below, a Standard Logic app with a prewarmed instance count of 5 can scale out to its maximum scaling of 60 under 10 minutes. The message fetching and message processing abilities scale out together, preventing the generation of “dead-letters.”  

Also, from the results in our horizontal scaling experiments, we see that having more prewarmed instances does not affect the steady-state throughput of the workflow.  

Recommendations 

With these two findings, we recommend keeping the minimum instance number small for cost-saving, without any impact on your peak performance. If a use case requires a higher throughput, the maximum burst instances setting can be set higher to accommodate that. For production workflows, we still recommend having at least two always-ready instances, as they would reduce any potential downtime from reboots. 

Updated Nov 26, 2024
Version 2.0
No CommentsBe the first to comment