Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda Memory Vs CPU configuration

In AWS lambda environment we can specify only the memory configuration. Is there any documentation as to what the CPU config will be for a given memory configuration?

For example,

  ApiLambda:
    Type: AWS::Serverless::Function
    Properties:
      Description: "This function handles the example"
      CodeUri: "./app/"
      Handler: "app.handle_request"
      MemorySize: 128
      Timeout: 60
      Runtime: python3.7

I am trying to find the minimum MemorySize for a particular number of cores. Is there any way to know the boundaries of MemorySize where the #Cores changes without bruteforcing MemorySize?

Ref:

https://aws.amazon.com/about-aws/whats-new/2020/12/aws-lambda-supports-10gb-memory-6-vcpu-cores-lambda-functions/ https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html

like image 734
Jimson James Avatar asked Mar 08 '21 00:03

Jimson James


People also ask

How much memory should I allocate to AWS Lambda?

The Lambda console defaults new functions to the smallest setting and many developers also choose 128 MB for their functions. However, 128 MB should usually only be used for the simplest of Lambda functions, such as those that transform and route events to other AWS services.

How does AWS Lambda memory work?

Starting today, you can allocate up to 10 GB of memory to a Lambda function. This is more than a 3x increase compared to previous limits. Lambda allocates CPU and other resources linearly in proportion to the amount of memory configured. That means you can now have access to up to 6 vCPUs in each execution environment.

What CPU does AWS Lambda use?

AWS Lambda Functions Powered by AWS Graviton2 Processor – Run Your Functions on Arm and Get Up to 34% Better Price Performance. Many of our customers (such as Formula One, Honeycomb, Intuit, SmugMug, and Snap Inc.) use the Arm-based AWS Graviton2 processor for their workloads and enjoy better price performance.

How can you give your Lambda function more CPU capacity so it completes faster?

The more memory, the more CPU resource and network bandwidth the function receives but also the higher cost per millisecond of execution time. For CPU intensive workloads, raising the memory allocation setting is a great way to give the function more power to complete the workload quicker.

Is it possible to specify the CPU configuration in AWS Lambda environment?

In AWS lambda environment we can specify only the memory configuration. Is there any documentation as to what the CPU config will be for a given memory configuration?

What is the memory limit for AWS Lambda?

AWS Lambda customers can now provision Lambda functions with a maximum of 10,240 MB (10 GB) of memory, a more than 3x increase compared to the previous limit of 3,008 MB. This helps workloads like batch, extract, transform, load (ETL) jobs, and media processing applications perform memory intensive operations at scale.

What is AWS Lambda and how does it work?

AWS Lambda runs your code on an highly available and scalable compute infrastructure so that you can focus on what you want to build. Do you want to get the advantages of Lambda for workloads that are memory or computationally intensive? Wait no more! Starting today, you can allocate up to 10 GB of memory to a Lambda function.

What is the @memory setting in lambda?

Memory is the amount of memory available to your Lambda function at runtime. You can increase or decrease the memory and CPU power allocated to your function using the Memory (MB) setting. To configure the memory for your function, set a value between 128 MB and 10,240 MB in 1-MB increments.


1 Answers

The official thresholds are:

  • 1 vCPU for 1,769 MB (ref)
  • 6 vCPUs for 10,240 MB (ref)

Recent study concludes the following for what is happening in-between:

enter image description here

like image 151
Marcin Avatar answered Oct 24 '22 22:10

Marcin