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?

posta 4 anni fa248 visualizzazioni
1 Risposta
0
Risposta accettata

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
con risposta 4 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande