AWS Step Functions嵌入式工作流似乎有2-3秒的额外开销。

huangapple go评论57阅读模式
英文:

AWS Step functions embedded workflows appear to have 2-3 second overhead

问题

I'm creating a Step function workflow with multiple embedded workflows (using startExecution.sync:2). I noticed that all of the embedded workflows appear to have a 2-3 second overhead. This appears to be the same across all of my embedded workflows. Is this normal or am I doing something wrong?

Looking at the runtime for the logic in one of the embedded workflows, the time spent was milliseconds, however, when looking at the parent the time spent on that execution task was over 2 seconds. I would have expected it to only tike milliseconds at the parent level as well.

我正在创建一个包含多个嵌套工作流的Step函数工作流(使用startExecution.sync:2)。我注意到所有嵌套工作流似乎都有2-3秒的开销。这在所有嵌套工作流中似乎都是相同的。这是正常的吗,还是我做错了什么?

在查看一个嵌套工作流中逻辑的运行时时,花费的时间是毫秒级的,但是在查看父级时,执行任务的花费时间超过了2秒。我本来期望在父级层面上也只需要毫秒级的时间。

英文:

I'm creating a Step function workflow with multiple embedded workflows (using startExecution.sync:2). I noticed that all of the embedded workflows appear to have a 2-3 second overhead. This appears to be the same across all of my embedded workflows. Is this normal or am I doing something wrong?

Looking at the runtime for the logic in one of the embedded workflows, the time spent was milliseconds, however, when looking at the parent the time spent on that execution task was over 2 seconds. I would have expected it to only tike milliseconds at the parent level as well.

答案1

得分: 0

在使用运行作业(.sync)集成模式执行作业后和Step Functions工作流继续执行之间出现2-3秒的延迟并不罕见。

通过这些优化的集成,Step Functions调用目标服务(在本例中是自身),以启动一个异步流程(在本例中是Step Functions工作流执行)。目标服务返回异步流程的标识符给Step Functions,然后暂停调用工作流执行。

然后,Step Functions以固定间隔轮询目标服务(通常使用Describe* API操作)以确定作业何时完成。对于支持Amazon EventBridge事件的服务,Step Functions将在您的帐户中创建一个托管规则,以便更快地了解作业完成(Step Functions是这样的服务之一)。当调用工作流执行通过事件或轮询响应了解到完成时,它会继续工作流执行。

考虑到这些异步交互,作业完成和调用工作流执行恢复之间将会有延迟。

如果Express Workflows满足您嵌入式工作流的需求,您可以使用StartSyncExecution API操作来调用它们,使用AWS SDK服务集成。Step Functions将以与AWS Lambda相同的方式同步调用它们,从而减少延迟。

英文:

2-3 second latency between completion of a job executed using the Run a Job (.sync) integration pattern and continuation of the Step Functions Workflow is not uncommon.

With these optimized integrations, Step Functions makes a call to the target service (in this case to itself) to start an asynchronous process (in this case a Step Functions Workflow Execution). The target service returns an identifier for the asynchronous process to Step Functions which pauses calling workflow execution.

Step Functions then polls the target service (typically using a Describe* API Action) at a regular interval to determine when the job completes. For serivces which support Amazon EventBridge events, Step Functions will create a Managed Rule in your account so that it can learn of job completion more quickly (Step Functions is one such service). When the calling workflow execution learns of completion via an event or a poll response, it continues the workflow execution.

Given these asynchronous interactions, there will be latency between completion of the job and resumption of the calling workflow execution.

If Express Workflows will meet the needs for your embedded workflows, you can call them using the StartSyncExecution API Action with AWS SDK Service Integrations. Step Functions will then call these synchronously in the same way it does with AWS Lambda which will reduce the latency.

答案2

得分: 0

更新:我联系了AWS支持,他们回复如下:

你好,

从你的查询中,我了解到你创建了一个具有多个嵌套工作流的步骤函数工作流,即使用startExecution.sync:2启动了一个嵌套工作流,并在执行任务时观察到父工作流中延迟了2-3秒。但是,在执行每个嵌套工作流的逻辑时,所花费的时间是以毫秒为单位的。你想了解这是否是预期行为。

在这里,我想告诉你,当使用.sync集成模式1启动嵌套工作流执行时,父状态机在了解嵌套状态机执行完成状态时会观察到2-3秒的延迟。请注意,内部团队已经意识到这个问题,并将其确定为预期行为。

他们正在努力改进在嵌套状态机的.sync集成中的这种延迟。我们无法看到该功能的路线图和积压情况,不幸的是,我们无法提供何时将实施此功能的预计时间。因此,我要求你密切关注“最新消息”页面或AWS博客,因为所有新的功能请求和增强功能都会在那里发布。

[+] AWS博客:https://blogs.amazon.com/ [+] 最新消息:https://aws.amazon.com/new/ [+] AWS发布说明:https://aws.amazon.com/releasenotes/ [+] AWS Step Functions Compute Blog:https://aws.amazon.com/blogs/compute/tag/aws-step-functions/

为了避免.sync集成引起的2-3秒延迟,作为一种解决方法,我们建议你使用.waitForTaskToken集成模式,而不是.sync集成模式。使用.waitForTaskToken 2 集成模式来执行嵌套状态机,可以消除2-3秒的延迟。

1 https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync
2 https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token

切换到waitForTaskToken对我起效果。

英文:

Update: I contacted AWS support and they responded with the following:

> Hello,
>
> From your query, I understand that you have created a Step Function
> workflow with multiple embedded workflows i.e. a nested workflow using
> startExecution.sync:2 and observed a delay of 2-3 seconds in the
> parent workflow while executing the task. However, the time spent in
> executing the logic in each of the embedded/nested workflow is in
> milli seconds. You wanted to understand if this is the expected
> behavior or not.
>
> Here, I would like to inform you that when an embedded/nested workflow
> execution is started using .sync integration pattern 1, there is a
> 2-3 seconds latency observed in parent StateMachine becoming aware of
> nested StateMachine execution completion status. Kindly note that the
> internal team is aware of this issue and identified it as an expected
> behavior.
>
> They are working to improve this latency in case of a .sync
> integration with nested StateMachines. We do not have the visibility
> regarding the feature's roadmap and backlog and unfortunately, we will
> not be able to provide an ETA on when this will be implemented.
> Therefore I would kindly request you to keep an eye on the what’s new
> page or the AWS Blogs as all new feature requests and enhancements are
> posted there.
>
> [+] AWS blogs: https://blogs.amazon.com/ [+] What’s New:
> https://aws.amazon.com/new/ [+] AWS Release Notes:
> https://aws.amazon.com/releasenotes/ [+] AWS Step Functions Compute
> Blog: https://aws.amazon.com/blogs/compute/tag/aws-step-functions/
>
> As a workaround to avoid this 2-3 seconds delay caused by .sync
> integration, we would request you to leverage .waitForTaskToken
> integration pattern instead of .sync integration pattern. Using
> .waitForTaskToken 2 integration pattern with nested StateMachine
> execution, eliminates the 2-3 seconds delay.
>
> 1
> https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync
> 2
> https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token

Switching to the waitForTaskToken worked for me.

huangapple
  • 本文由 发表于 2023年4月6日 22:00:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/75950391.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定