Amazon Simple Workflow Service (SWF) is a task based API that makes it easy to coordinate work across distributed application components. It provides a programming model and infrastructure for coordinating distributed components and maintaining their execution state in a reliable way. Using Amazon SWF, we can focus on building the aspects of the application that differentiates it.
A workflow is a set of activities that carry out some objective, including logic that coordinates the activities to achieve the desired output. Workflow history consists of complete and consistent record of each event that occurred since the workflow execution started. It is maintained by SWF.
Amazon SWF is a fully-managed state tracker and task coordinator in the Cloud. You create desired workflows with their associated tasks and any conditional logic you wish to apply and store them with SWF.
Amazon SWF (Simple workflow service) helps in building applications which make use of Amazon’s cloud, by coordinating work across distributed component units. Coordinating work/task involves the management of dependencies among tasks, scheduling them, and concurrency which should go hand-in-hand with the logical flow of the application.
A ‘task’ is used to represent a logical unit of work that can be performed by one of the components present in the workflow.
SWF gives the user full control over the implementation of tasks, as well as coordinating between them without having to be concerned about the underlying complexities which include tracking the progress of the tasks as well as maintenance of the task state.
Tasks can be performed by implementing ‘workers’. These ‘workers’ run on cloud infrastructure (such as Amazon Elastic Compute Cloud or the user’s premise).
A wide variety of tasks can be created. Some of them have been listed below:
⦁ Tasks that run for long periods of time.
⦁ Tasks that could fail.
⦁ Tasks that could timeout.
⦁ Tasks that need to be restarted at some point in time.
⦁ Tasks that have varying throughput and latency measures.
⦁ Tasks are stored and assigned to ‘workers’ when they are ready. Their progress is tracked by SWF, and it also helps in maintaining their state, which includes details regarding the time they took to complete.
SWF API comes with many data types which can be used by ‘actions’. Some of them have been listed below:
Features of Amazon SWF:
Amazon SWF automatically scales the resources along with your application’s usage. There is no manual administration of the workflow service required when you add more cloud workflows or increase the complexity of the workflows.
Amazon SWF runs at Amazon’s highly available data centers, therefore the state tracking is provided whenever applications need them. Amazon SWF stores the tasks, sends them to their respective application components, keeps a track on their progress.
Amazon SWF completely replaces the complexity of the old workflow solutions and process automation software with new cloud workflow internet service. It eliminates the need for the developers to manage the automation process so that you can focus on the unique functionality of an application.
4) Logical separation
Amazon SWF provides a logical separation between the control flow of your background job’s stepwise logic and the actual units of work that contains business logic. Due to the logical separation, you can separately manage, maintain, and scale “state machinery” of your application from the business logic. According to the change in the business requirements, you can easily manage the business logic without having worry about the state machinery, task dispatch, and flow control.
Amazon SWF allows you to modify the application components, i.e., you can modify the application logic in any programming language and runs them within the cloud or on-premises.
Benefits of Amazon SWF:
It enables applications to be stateless, because all information about a workflow execution is stored in its workflow history.
For each workflow execution, the history provides a record of which activities were scheduled, their current statuses and results. The workflow execution uses this information to determine the next steps.
The history provides steps in detail that can be used to monitor running workflow executions and verify completed workflow executions.
Amazon SWF Concepts:
A set of activities that carry out some objective, together with logic that coordinates the activities.
Workflows coordinate and manage the execution of activities that can be run asynchronously across multiple computing devices and that can feature both sequential and parallel processing.
Each workflow runs in an AWS resource called a domain, which controls the workflow’s scope.
An AWS account can have multiple domains, each of which can contain multiple workflows, but workflows in different domains can’t interact.
When you register an activity to a workflow, you provide information such as a name and version, and some timeout values based on how long you expect the activity to take.
An activity task tells an activity worker to perform its function.
SWF stores tasks and assigns them to workers when they are ready, tracks their progress, and maintains their state, including details on their completion.
To coordinate tasks, you write a program that gets the latest state of each task from SWF and uses it to initiate subsequent tasks.
Activity tasks can run synchronously or asynchronously. They can be distributed across multiple computers, potentially in different geographic regions, or they can all run on the same computer.
Activity tasks for a running workflow execution appear on the activity task list, which is provided when you schedule an activity in the workflow.
If you don’t specify a task list when scheduling an activity task, the task is automatically placed on the default task list.
Executes a Lambda function instead of a traditional SWF activity.
A Decision task tells a decider that the state of the workflow execution has changed so that the decider can determine the next activity that needs to be performed. The decision task contains the current workflow history.
SWF assigns each decision task to exactly one decider and allows only one decision task at a time to be active in a workflow execution.
Any application that can initiate workflow executions.
An activity worker is a program that receives activity tasks, performs them, and provides results back.
Implement workers to perform tasks. These workers can run either on cloud infrastructure, or on your own premises.
Different activity workers can be written in different programming languages and run on different operating systems.
Assigning particular tasks to particular activity workers is called task routing. Task routing is optional.
A software program that contains the coordination logic in a workflow.
It schedules activity tasks, provides input data to the activity workers, processes events that arrive while the workflow is in progress, and ultimately ends the workflow when the objective has been completed.
Both activity workers and the decider receive their tasks by polling the SWF service.
Workflow Execution History:
The workflow execution history is composed of events, where an event represents a significant change in the state of the workflow execution. SWF informs the decider of the state of the workflow by including, with each decision task, a copy of the current workflow execution history.
Deciders and activity workers communicate with SWF using long polling.
Amazon SWF Pricing:
You pay for workflow executions when you start them and for each 24-hour period until they are completed. The first 24 hours of workflow execution are free.
You pay for “markers” (custom workflow execution log entries), start timers, or receive signals of additional tasks generated from a workflow.
Data transferred between SWF and other AWS services within a single region is free of charge. Data transferred between SWF and other AWS services in different regions will be charged at Internet Data Transfer rates on both sides of the transfer. First 1 GB of transferred data is free.