How to minimize time consumption in lambda?

0

My client is using many lambda functions in his serverless application. He asked me for some resources to reduce the amount of time that his functions run. So he is trying to minimize the time that it takes to run the functions. I pointed to the function configuration (i.e. increase the memory to 3008 MB). But other than that what else can he do?

asked 4 years ago227 views
1 Answer
0
Accepted Answer

But other than that what else can he do?

Additional questions may need to be asked to really get to the bottom of what it is your client is trying to achieve.

  • Are they strictly trying to reduce latency with no regard to cost?

If this is the case, then yes increasing memory size to the max may help, but I would recommend using Lambda Power Tuning to optimize memory configuration for your desired outcome (ie: best time vs best cost).

  • What is causing the latency the client is trying to reduce?

Using AWS X-Ray will give you insight on where the time is being spent. This can answer questions including how long the lambdas are taking to initialize, which may be a big contributor to your overall function time. Depending on your observations, some optimizations could include:

  1. Taking advantage of the AWS Lambda execution context for managing connections and performing in-memory caching.
  2. Reusing TCP connections if you're experiencing latency on AWS SDK calls
  3. Utilizing Provisioned Concurrency if your optimized lambdas still experience long cold start times.

Additional Resources:

Optimizing Lambda Performance for Your Serverless Applications - AWS Online Tech Talks

Lumingo - How To Optimize AWS Lambda Performance

AWS
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions