简体   繁体   English

AWS Lambda使用node.js将文件上传到S3时需要花费时间

[英]AWS Lambda Consumes time when uploading files to S3 using node.js

My program on lambda works as it starts by fetching the file from twilio with the help of url and then it stores it on my /tmp in lambda then that file is uploaded to aws S3 from lambda's /tmp . 我在lambda上的程序通过从url的帮助下从twilio提取文件开始,然后将其存储在lambda上的/ tmp中,然后将该文件从lambda的/ tmp上传到aws S3。 My concern is that if its a large file say 200MB then for that time lambda runs for a lot of time . 我担心的是,如果它的大文件说200MB,那么lambda会运行很长时间。 Is there any way of stopping the lambda while it is uploading to s3 and then wakes when s3 upload is completed successfully. 有什么方法可以在将lambda上传到s3时停止它,然后在s3上传成功完成时唤醒。 And can similar concept possible for downloading so that lambda could stop and when file is uploaded to /tmp it wakes and does the uploading of file to the AWS S3 . 并可以使用类似的概念进行下载,以便lambda可以停止,并且在将文件上传到/ tmp时它会唤醒并将文件上传到AWS S3。 That can save a lot of time 这样可以节省很多时间

The hard drive where /tmp exists and the CPU that is processing the upload/download and the memory needed for buffers used by the upload/download... are provided by the running Lambda container that is processing the transfer. 正在运行传输的Lambda容器提供了/tmp所在的硬盘驱动器和正在处理上载/下载的CPU以及上载/下载所使用的缓冲区所需的内存...。

The fact that you have access to these resources is exactly because you are paying for a running Lambda container. 您有权访问这些资源的事实恰好是因为您要为运行的 Lambda容器付费。

If it were possible to stop it from running, or pause it, you would have no access to those resources, and the upload/download would stop happening. 如果可以停止运行或暂停它,则您将无权访问这些资源,并且上载/下载将停止。

This isn't possble. 这是不可能的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM