Geek Culture
Published in

Geek Culture

Pick the right memory size for your AWS Lambda functions

Getting it right can improve speed and decrease costs. But it’s not as straightforward as it seems.

Photo by Julian Hochgesang on Unsplash

AWS couples memory size and CPU power

Experimental design: A basic serverless GET API

  1. Receives an HTTP event from API Gateway
  2. Gets an item from DynamoDb (using Pynamodb)
  3. Publish an event to EventBridge (using Boto3)
  4. Return an HTTP response

Results: 768MB optimize for speed, 512MB for costs, 1024+MB when expecting many cold-starts

Average duration per AWS Lambda execution in ms
Price per 1 Mio AWS Lambda executions in USD (incl. request costs)

The cold start problem

Don’t forget about the real-world experience.

Measured response times in ms

Conclusion: Know your use case

--

--

A new tech publication by Start it up (https://medium.com/swlh).

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store