Why use nodeJs with asynchronous functions with AWS-Lambda?

1

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

Nowadays NodeJs are used as an application backend with the advantage of natively developing asynchronous server requests through assync-wait or promises. This brings a layer of complexity to the code much larger than when compared to the same application that does not use 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 tread pool - or at the same time.

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

Now, of course, the lambda function offers you the possibility to 1000 instances available at any time , what would be the advantage of using NodeJs with the justification of having the same asemail (sendEmail) function?

    
asked by anonymous 19.09.2018 / 22:03

1 answer

0
Hello, I'm not a NodeJS expert and I do not use it with lambdas, but as far as I understand: the use of promises with lambda ( link ) simplifies successive (cascaded) network requests, making maintenance easier and eliminating callbacks.

In ES2017 we have async / await that further simplifies the use of promises ( link ) making it even easier to read and maintain.

In short, as far as I understand: the purpose of using promises or async / await with lambda is not to increase the built-in function pool (this really does not make sense to me either) rather simplify building a function that needs call other 3, for example, cascaded.

It does not seem to me to be too complex, in fact the purpose is to remove the complexity of using callbacks, perhaps it is more related to learning the new syntax and using it in everyday life.

See what you think of the links I put up and if my comment makes sense. Abrs =)

    
14.11.2018 / 11:59