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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인