Is the runtime multi-threaded? #440
-
Hi folks, noob question. Can I make my code more performant if I thread tasks? I have no idea what hardware it runs on. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @vladinator1000! Short answer is that it depends on the amount of memory configure. On Lambda, you get an amount of CPU resources proportional to the amount of memory you configure, with a maximum of 6 vCPUs at 10GB. At 1769 MB of RAM, you'll get the equivalent of 1 full vCPU (you can use 1 vCPU-second per second your Lambda function is executing to run instructions), but this might be shared between 2 vCPUs. If you're using Rust 1.59.0, you can use |
Beta Was this translation helpful? Give feedback.
Hey @vladinator1000!
Short answer is that it depends on the amount of memory configure. On Lambda, you get an amount of CPU resources proportional to the amount of memory you configure, with a maximum of 6 vCPUs at 10GB. At 1769 MB of RAM, you'll get the equivalent of 1 full vCPU (you can use 1 vCPU-second per second your Lambda function is executing to run instructions), but this might be shared between 2 vCPUs.
If you're using Rust 1.59.0, you can use
std::thread::available_parallelism
to see what's a reasonable amount of parallelism you should use with the amount of memory you've configured.