When we specify the memory size for a Lambda function, AWS will allocate CPU proportionally. For example, a 256 MB function will receive twice the processing power of a 128 MB function. That looks simple and straightforward, but…
I had this question: would there be an ideal memory size that minimizes the cost of running a given task on Lambda?
In order to answer that, I tested the same task running on multiple memory sizes to check whether such cost/memory trade-off sweet spot exists.
I created two Lambda functions to run this test:
The code is open sourced, in case you’d like to test your own Lambdas. The results presented below will certainly vary according to the function you test, so I encourage you to download the Benchmarker Lambda and run it for yourself.
Photo by Stephen Dawson on Unsplash
#aws-lambda #monitoring #observability #serverless