Why use nodejs with asynchronous functions with AWS-Lambda?

Asked

Viewed 137 times

1

AWS-Lambda services can be developed in Java, C#, Python, Go, Powershell and finally Nodejs (DOC).

Nodejs is currently used as a backend of applications with the advantage of natively developing asynchronous requests to the server via assync-Wait or Promises. This brings a much higher layer of complexity to code than when compared to the same application that makes no use of asynchronous functions.

The idea is simple - if you have a server running on Nodejs that will provide a function (sendemail for example) and it can respond to 4 simultaneous requests in the same treads pool - or at the same time.

One of the advantages of AWS-Lambda is that the function (itself) is self scalable and allows competition naturally (regardless of the language chosen - DOC).

Well, if the lambda function offers you the possibility of having 1000 instances available at any time, what would be the advantage of using Nodejs on the grounds of having the same asynchronous (sendemail) function?

1 answer

0

Hello, I am not an expert Nodejs and I do not use it with Lambda, but as far as I understand: the use of Premomises with lambda (https://medium.com/vandium-software/simplify-and-secure-your-node-js-aws-lambda-code-with-vandium-part-2-30c404884e21) simplifies successive network requests (cascateados) codes, facilitating maintenance and eliminating callbacks.

In ES2017 we have async/await which further simplifies the use of Promises (https://irvinlim.com/blog/async-await-on-aws-lambda/) making it even easier to read and maintain.

In short, as far as I understand it: the goal of using Promises or async/await with lambda is not to increase the pool of built Function (this really doesn’t make sense to me either) but to simplify the construction of a Function that needs to call another 3, for example, in a cascateada.

Nor does it seem to me more complex to use, in fact the goal is precisely to remove the complexity of using callbacks, maybe it is more related to learning the new syntax and use in everyday life.

See what you think of the links I put above and if it makes sense my comment. Aprs =)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.