Why should we use Lambda and when to avoid it

Pravin Lolage
Pravin Lolage
Published in
3 min readMar 12, 2019
AWS Lambda

What is AWS Lambda?

  • AWS Lambda is a compute service that lets you run code without provisioning or managing servers.
  • AWS Lambda executes your code only when needed and scales automatically, from a few requests per day to thousands per second.
  • AWS Lambda runs your code on a high-availability compute infrastructure
  • It performs all of the administration of the compute resources, including server and operating system maintenance, capacity provisioning and automatic scaling, code monitoring and logging.

Benefits of AWS Lambda

  • As it’s simple to write and execute on AWS it doesn’t require any program to execute.
  • It can be deployed easily if you are using the right framework.
  • It always ensures high availability.
  • Lambda can be run on events like when the file is uploaded to S3, on a dynamoDB change, etc.
  • Cost effective, as charges are dependent on your code execution time and no of requests.
  • Lambda provides us the metrics and logs for tracking function executions.
  • Lambda supports a wide range of languages such as Java, Node.js, Python, and C#

Recommendations to use AWS Lambda

  • If your Lambda function would be running for hours, it should rather go to Beanstalk or EC2 than Lambda.
  • If the deployment package jar is larger than 50 MB, it should be broken down to multiple packages and functions.
  • If the requests payloads exceed the limits, you should break them up into multiple request endpoints.
  • It all comes down to prevent deploying monolithic applications as Lambda functions, and serve stateless microservices as a collection of functions instead.
  • Controlling a powerful highly scalable service, things can go horribly wrong if functions not implemented well, so always make sure you have architected and tested thoroughly before publishing your functions live.

Limitations

Throttle Limit

  • The throttle limit is 100 concurrent Lambda function executions per account and is applied to the total concurrent executions across all functions within the same region.
  • When the throttle limit is reached, then it returns a throttling error having an error code 429. The throttle limit can be increased by contacting the AWS support center.

Resources Limit

  • Ephemeral disk capacity (“/tmp” space) is 512 MB
  • Number of file descriptors are 1024
  • Number of processes and threads (combined total) are 1,024
  • Maximum execution duration per request is 300 seconds
  • Invoke request body payload size is 6 MB
  • Invoke response body payload size is 6 MB

Service Limit

  • Lambda function deployment package size (.zip/.jar file) is 50 MB
  • Size of code/dependencies that you can zip into a deployment package (uncompressed zip/jar size) is 250 MB
  • The total size of all the deployment packages that can be uploaded per region is 1.5 GB
  • Number of unique event sources of the Scheduled Event source type per account is 50
  • Number of unique Lambda functions you can connect to each Scheduled Event is 5

Thanks for reading!

If you like the above article please clap the same and if you don’t like please put your thoughts in comments so that I can improve it.

You can reach me out on Linkedin, Quora.

--

--

Pravin Lolage
Pravin Lolage

A software enthusiast with almost 8+ years of experience in programming trying to share my knowledge.