AWS Step Functions: Best Practices for Activity Workers and Tasks

Recommended Practices for Activity Workers and Tasks in Amazon Step Functions

Prev Question Next Question

Question

Your development team is planning on working with Amazon Step Functions.

Which of the following is a recommended practice when working with activity workers and tasks in Step Functions? Choose 2 answers from the options given below.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - A and C.

The AWS Documentation mentions the following.

By default, the Amazon States Language doesn't set timeouts in state machine definitions.

Without an explicit timeout, Step Functions often relies solely on a response from an activity worker to know that a task is complete.

If something goes wrong and TimeoutSeconds isn't specified, an execution is stuck waiting for a response that will never come.

Executions that pass large payloads of data between states can be terminated.

If the data you pass between states might grow to over 32 KB, use Amazon Simple Storage Service (Amazon S3) to store the data, and pass the Amazon Resource Name instead of the raw data.

Alternatively, adjust your implementation so that you pass smaller payloads in your executions.

Option B is incorrect since States can have multiple incoming transitions from other states.

Because the documentation clearly mentions the best practices, the other options are invalid.

For more information on the best practices, please refer to the below URL-

https://docs.aws.amazon.com/step-functions/latest/dg/sfn-best-practices.html

When working with Amazon Step Functions, it is essential to follow some recommended practices to ensure the success of your workflow execution. Two of these recommended practices include:

  1. Specifying a timeout in state machine definitions: When defining a state machine in Amazon Step Functions, it is crucial to specify a timeout for each state. This timeout will define the maximum time that a task can run before it is considered failed. If the task exceeds the defined timeout, the state machine will move to the next state and mark the task as failed. Specifying a timeout is essential to ensure that your state machine progresses correctly and does not get stuck in a state due to a task that is taking too long to complete.

  2. Using Simple Storage Service (S3) for passing larger payloads between states: If you are passing larger payloads between states, it is recommended to use Amazon S3 to store these payloads instead of passing them directly between the states. Passing large payloads between states can cause performance issues and slow down the execution of your state machine. Storing the payloads in Amazon S3 and passing only the S3 object's key between states can significantly improve the performance and speed of your state machine execution.

In summary, it is recommended to specify a timeout for each state in your state machine definition and use Amazon S3 for passing larger payloads between states when working with Amazon Step Functions.