DEV Community

Discussion on: Are Lambda-to-Lambda calls really so bad?

Collapse
 
rehanvdm profile image
Rehan van der Merwe

I once helped a client that was in a bit of a pickle. They outsourced worked and got a horror story of Lambdas calling Lambdas back (think it needs to be coined, Lambda nest ?).

The developer(s) could not get a Lambda inside the VPC to speak to RDS and to the public internet. So the developer decided to write all the database queries inside X amount of Lambdas, basically a single query per Lambda. Then the API GW Lambdas not in the VPC would call these "database Lambdas" directly using the SDK.

  • They ended up with a 32 Lambdas for about 5 API calls before the client realized something is fishy and got a second opinion.
  • Debugging was extremely difficult on my local machine.
  • Payload limits between Lambdas where reached and then needed to be stored on S3. The S3 object path is then passed between Lambdas.
  • Database connections not closed correctly so you can imagine the amount of open connections was basically maxed out on the RDS.

So I think it needs a sticker. Danger Zone: do not attempt Lambda-to-Lambda calls unless you absolutely know what you are doing.

Collapse
 
byrro profile image
Renato Byrro

It also relates to how small/big a Lambda function should be.

Maybe developers are confusing the idea of a "Lambda function" with their programming language's function statement. It's not the same. I think Lambda should be seen closer to a containerized app than to a tiny programming function.

Collapse
 
rehanvdm profile image
Rehan van der Merwe

100% what happened in this scenario.