Kit Ho
Kit Ho

Reputation: 26968

Asynchronous I/O , I/O does it include Network request as well?

I am confused with the word asynchronous I/O in node.js

Does I/O only refer the read/write hard disk operation?

What about HTTP request to the third party service, would that also count as I/O and get the benefit of asynchronous I/O model?

from this node cast http://nodecasts.net/episodes/1-introduction-to-nodejs

Node.js is a software platform for writing fast and scalable network applications. It is event driven and uses non-blocking I/O. Due to it's use of non-blocking I/O, it can handle many requests with a single process.

From the quote of Due to it's use of non-blocking I/O, it can handle many requests with a single process. In my application, I would have a high concurrency of writing things into a MQ server using HTTP request, I am not sure if i can get benefit using Node.js in this model.

Thanks

Upvotes: 1

Views: 1120

Answers (2)

mscdex
mscdex

Reputation: 106696

It's basically all kinds of I/O: file, network, child processes (and their input/output streams), etc.

So the network I/O would include things like UDP sending/receiving and TCP connections and any protocols layered on top of them such as HTTP requests, SSH connections, SIP connections, etc.

In the case of a message queue server, node could query the server but wait in the background for a response without blocking the rest of the program. This is especially useful if you are performing many message queue requests in parallel or you could have an HTTP server that can still take requests while still waiting for a response from the message queue server.

Upvotes: 2

rajeshwerkushwaha
rajeshwerkushwaha

Reputation: 311

Asynchronous means never wait for anyone. So just implement this thing with anyone whether you are getting any value from server or from anywhere just never wait for the response.

You can implement this in networking things and NodeJs suits very well for networking kind of stuff.

Upvotes: 0

Related Questions