On Tue, Mar 20, 2018 at 12:54 AM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:
An Await waits by transferring control to the event loop! How on earth
would node else continue to process other code waiting for resources.
Henrik,
I appreciate the thought you put into your message, and the detail. It
emphasizes that Node.js developers not only write code that implements
functional requirements, but they must also write code and use language
constructs that yield control to Node's event loop. Otherwise your code
would not play well with other processing that needs to be allowed to run.
That must be a stretch for a lot of developers, particularly traditional
IBM i developers who are accustomed to having the operating system manage
concurrency and the resource requirements of other processes.
In regard to your batch example, Node.js developers should be aware of the
additional overhead and latency added by using Node.js language constructs
that yield control to the event loop.
http://bit.ly/2FQZqCr
In the case of reading files from the local file system, Node.js
async-await adds 10-25 times to complete the read cycle in comparison to
synchronous processes written in Python. Imagine how much longer that would
take if a batch process were working against a remote database which
entails not only reading from a file system, but add to that the
requirements of inter-system communications.
To me, that would be a strong case for using RPG to implement batch
processes against IBM i databases as opposed to force-fitting that into a
Node.js service.
As an Amazon Associate we earn from qualifying purchases.