0

when thinking about lambda costs for memory/requests, is there any evidence to suggest having larger functions with many package includes vs many smaller functions with minimal packages is a better option?

for example

script A has 1(aws-sdk) + 9 required packages to complete 4 steps
-> this would be a single script request with a longer execution time ( and larger memory requirement?

vs

4 scripts with three packages each 1(aws-sdk) + two required packages to complete 4 steps
-> this would be multiple single script requests with a shorter execution time ( and less memory requirement?

1 Answer 1

1

Its difficult to recommend whether to use larger functions without going details into the exact scenarios. However in general, rather looking at function division based on file size, divide the functions based on business capabilities and maintainability.

Lambda is having a billed duration which is rounded up to the nearest 100 millisecond. In term of Cost, it make sense to have large functions with right file size(Not too small) that executes for long enough. On the other hand, this impacts initial Cold Start performance of the Lambda function. Also having to many small functions make it difficult to maintain.

So based on your application priorities of Cost and Performance and Grouping of Business Capabilities, divide the Lambda functions as Serverless Microservices.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.