top of page
Derek Marley

Azure Logic Apps -> Stateful vs. Stateless Workflows



Goal: Breakdown of the key performance differences and trade-offs between stateful and stateless Logic Apps:


Stateful Logic Apps:


  •  High Resiliency: Designed to withstand outages. If an outage occurs, stateful logic apps can be reconstructed from their saved state and rerun to completion once services are restored.

  • Long-Running Processes: They can run for extended periods, making them suitable for workflows that require persistent state and the ability to track progress over time.

  • Detailed Run History: Stateful logic apps store input, output, and workflow states in external storage. This allows for comprehensive review and debugging after each run.

  • Performance Considerations: The reliance on external storage for state persistence can introduce performance overhead compared to stateless logic apps.


Stateless Logic Apps:



  • Enhanced Performance: By not persisting state to external storage, stateless logic apps offer faster execution speeds, reduced latency, and higher throughput. This makes them well-suited for scenarios that prioritize performance.

  • Short-Lived Executions: Designed for shorter tasks with a maximum execution time of just a few minutes. Their in-memory operation makes them unsuitable for long-running processes.

  • Limited Run History: Input, output, and workflow states are not saved to external storage. While temporary debugging is possible, it impacts performance. This makes post-run analysis and debugging more challenging.

  • Message Size Limits: To prevent memory issues, stateless logic apps enforce payload size limit on messages. Larger files necessitate the use of stateful executions.

  • Synchronous Execution Only: They only support synchronous operations and are not suitable for asynchronous patterns requiring callbacks.



Choosing the Right Type:


  • Stateless Execution: Ideal for scenarios demanding low latency and high throughput, where run history isn't critical. Examples include read-heavy operations or integrations with systems like Dynamics 365 or Salesforce.

  • Stateful Execution: More suitable when reliability, durability, and comprehensive run history are essential, even at the cost of some performance overhead. This is preferable for long-running processes or tasks involving large data volumes.

Comments


bottom of page