gpt4 book ai didi

amazon-s3 - AWS S3 ObjectCreated 延迟触发 lambda

转载 作者:行者123 更新时间:2023-12-01 01:43:39 25 4
gpt4 key购买 nike

我已经为 配置了简单的触发器 lambda ,其中处理图像到达 S3 .
一般来说, lambda 以最小延迟触发,在 的同一秒内多次触发S3 收到图像。
但是,偶尔,大约 7% 的情况下,接收到的图像和 ObjectCreated 事件之间存在延迟,此延迟可能高达 19秒!! (平均 9-10 秒)。

知道如何避免这种延迟吗?

这个延迟让我无法使用 S3->Lambda 触发高性能实时应用程序。

最佳答案

过了一会儿,试图调查和谷歌搜索。

在向 AWS 支持人员询问此案例的同时,我终于从 AWS 得到了答案:

——

.. Lambda invoked the function pretty much immediately after we received the event, but the specific request id you shared was for an invoke that had to coldstart, which added nearly 10 seconds of extra latency.

The function is in the VPC, where cold starts tend to take a few seconds longer. Coldstarts cannot be eliminated but for high volume functions the incidence of cold start should be lower once you scale up and more containers are available for reuse.



正如您从答案中看到的那样,如果您正在尝试制作高性能/高流量的实时应用程序,S3->Lambda 将不符合您的要求。

我的下一个问题是,如果我直接从上传图像的脚本中触发 lambda,会有帮助吗?
或者我应该避免在此类应用程序中使用 lambda 并将其仅用于后台数据处理?

希望这个答案能帮助别人..

关于amazon-s3 - AWS S3 ObjectCreated 延迟触发 lambda,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53560689/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com