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?

已提問 4 年前檢視次數 244 次
1 個回答
0
已接受的答案

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
已回答 4 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南