Unlike Logic App Consumption, which is stateful by default, Logic App Standard Workflows can be configured to run in both stateful and stateless modes. These workflows cater to different use cases depending on whether you need to maintain state and history or optimize for speed and reduced resource usage.
Stateful Workflows
Stateful workflows maintain state information throughout their execution. They persist the state of the actions to storage, keeping a record of each action and trigger that occurs during the workflow. This includes saving inputs, outputs, and any intermediate states.
Key Characteristics:
- Persistence: Each step’s state and output are saved to Azure Storage, which means if a workflow fails or needs to be paused, it can be resumed from the point of failure.
- Durability: Stateful workflows are durable due to their persistence. They can handle long-running processes that might span minutes, hours, or even days.
- Re-run and Resumption: Since the state is maintained, stateful workflows can be re-run from any specific point in their execution history (https://techcommunity.microsoft.com/t5/azure-integration-services-blog/announcing-public-preview-of-resubmitting-from-an-action-in/ba-p/3953428). This is particularly useful for troubleshooting or when handling errors.
- History Tracking: All actions and triggers are logged, allowing for comprehensive monitoring and debugging. You can view a detailed run history of each workflow instance, including inputs, outputs, and actions taken.
- Suitable for Long-Running Processes: Ideal for scenarios requiring long-running processes, approval workflows, or any process where maintaining a detailed history and ability to resume is critical.
Stateless Workflows
Stateless workflows, in contrast, do not persist any state information beyond the execution of the workflow. They do not save inputs, outputs, or intermediate states to storage. Each execution is independent, and no historical data is kept once the run completes.
Key Characteristics:
- No Persistence: Stateless workflows execute actions without writing to storage, meaning they don’t retain state or history. Once an action is executed, its data is not saved.
- High Performance: Because stateless workflows do not involve writing to storage or maintaining state, they can execute faster and consume fewer resources, making them suitable for high-throughput scenarios.
- Low Latency: The lack of state persistence results in lower latency, making stateless workflows suitable for scenarios where speed is critical.
- No History Tracking: Since stateless workflows don’t keep a history, you cannot view detailed logs of inputs and outputs after execution. Only basic metrics such as run status are available.
- Suitable for Short-Lived Processes: This is ideal for scenarios that require simple, short-lived operations without the need for detailed tracking or resumption, like data transformations or simple API orchestration.
Main Differences Between Stateful and Stateless Workflows
Feature | Stateful Workflows | Stateless Workflows |
State Persistence | Persists state and history to Azure Storage | No state persistence; each execution is stateless |
Performance | Slower due to storage operations and durability overhead | Faster due to no storage writes and reduced latency |
Durability | Durable; can handle long-running processes | Not durable; designed for short-lived, quick executions |
Resumption | Can resume from the last known state after a failure | No resumption; each run is independent |
History Tracking | Full tracking of inputs, outputs, and actions | Limited tracking; only basic run status available |
Connectors | Managed connector triggers are available and allowed | Managed connector triggers are unavailable or not allowed. |
Chunking | Supports chunking | No support for chunking |
Async operations | Supports asynchronous operations | No support for asynchronous operations |
By understanding these differences, developers can choose the appropriate workflow type based on their specific application or process requirements.
To lazy to read? We’ve got you covered! Check out our video version of this content!
Hope you find this helpful! If you enjoyed the content or found it useful and wish to support our efforts to create more, you can contribute towards purchasing a Star Wars Lego for my son!