Reputation: 673
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.
The code works well on other systems, but on lambda function it does not works as expected.
I also tried this link: 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?
Upvotes: 3
Views: 7029
Reputation: 11481
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.
AWS measures CPU performance in vCPUs, where 1 vCPU is a virtualized thread on a CPU core.
With AWS lambda, the only thing you can scale vertically is memory, but CPU scales with it. To be precise, every 1,769MB of RAM corresponds to 1 vCPU.
Increase the vCPU count by increasing the RAM and you will see proportionally increased parallel processing performance.
Upvotes: 4