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?

preguntada hace 4 años248 visualizaciones
1 Respuesta
0
Respuesta aceptada

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
respondido hace 4 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas