Lambda is a serverless cloud compute service offered by Amazon Web Services (AWS). The service enables you to run backend code on AWS services without managing infrastructure. The code you run on AWS Lambda is called functions. You can use your own functions or pre-made functions. Once your function is loaded, you select an AWS event source. You can set up events according to your needs, and then let Lambda run automatically.

Lambda is a great solution if you don’t want to handle provisioning, resources, and other computing tasks. However, you still need to set up your functions and triggers in a way that ensures performance. This article explains how AWS Lambda performance is impacted by cold start time, execution time, and concurrency. You will also learn how to diagnose and optimize Lambda performance issues.

What Causes AWS Lambda Performance Issues?

When setting up functions with AWS Lambda several issues undermine the speed and flexibility that are supposed to come with serverless. When functions aren’t performing as expected, the following three causes are the most common culprit.

Cold start time

After invocation, functions stay warm for an undeclared amount of time. Generally around 30 minutes. After that, the function instance is killed and the next invocation requires a new instance to be created and initialized. This cold start adds time and cost to your operations. Latency for cold starts can be up to 10 seconds and you’re charged for the time it takes the function to warm up.

Execution time

Lambda functions are allowed to run for up to 15 minutes for each invocation. This is a hard limit that you can’t change. It also doesn’t matter why a function runtime is long, whether your function is waiting for responses, or if it requires extensive computation. Because of this limit, you should consider another method for any function that runs near 15 minutes.

Concurrency

With Lamba, each function instance can only be invoked one at a time. If you invoke it again during runtime a new instance is created up to your concurrency limit. Concurrency can burst up to 3k in the US (west and east) and Europe (Ireland), 1k in Asia Pacific (Tokyo) and Europe (Frankfurt), and 500 for other regions. For more concurrent instances you must request AWS to increase the number. If you do not, any invocations beyond the limit are throttled.

#aws-lambda #tips-and-tricks #aws-lambda-functions

AWS Lambda Performance: Pro Tips and Tricks
1.15 GEEK