简体   繁体   English

是否可以在 aws lambda function 中使用并行处理?

[英]Is it possible to use parallel processing in aws lambda function?

I want to process some code in parallel, I used threading.Thread and also multiprocessing.Process but weirdly they both took more time then normal execution which is the opposite of what i want.我想并行处理一些代码,我使用了threading.Threadmultiprocessing.Process但奇怪的是,它们都花费了比正常执行更多的时间,这与我想要的相反。

The code works well on other systems, but on lambda function it does not works as expected.该代码在其他系统上运行良好,但在 lambda function 上无法按预期运行。

I also tried this link: https://aws.amazon.com/blogs/compute/parallel-processing-in-python-with-aws-lambda/我也试过这个链接: https://aws.amazon.com/blogs/compute/parallel-processing-in-python-with-aws-lambda/

But didn't get any performance upgrade.但没有得到任何性能提升。

Can anyone tell me if its possible over lambda and if yes how can i do that?谁能告诉我它是否可能超过 lambda 如果是的话我该怎么做?

Yes, it is possible, you don't have to do anything special.是的,这是可能的,你不必做任何特别的事情。

The reason you saw degraded performance is because your lambda function was most likely too small.您看到性能下降的原因是您的 lambda function 很可能太小了。

AWS measures CPU performance in vCPUs, where 1 vCPU is a virtualized thread on a CPU core . AWS 测量 vCPU 中的 CPU 性能,其中1 个 vCPU 是 CPU 核心上的虚拟化线程

With AWS lambda, the only thing you can scale vertically is memory, but CPU scales with it.使用 AWS lambda,您唯一可以垂直扩展的是 memory,但 CPU 会随之扩展。 To be precise, every 1,769MB of RAM corresponds to 1 vCPU .准确地说, 每 1,769MB 的 RAM 对应于 1 个 vCPU

Increase the vCPU count by increasing the RAM and you will see proportionally increased parallel processing performance.通过增加 RAM 来增加 vCPU 数量,您将看到并行处理性能成比例地增加。

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

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