Why is NodeJs suitable for IO server?

Conceptual problems, I found some articles that I didn"t understand.

most articles say that NodeJs is suitable to be an IO server because of the high throughput of the asynchronous model. But the asynchronous model is supposed to mean that initiating an IO operation doesn"t have to wait for the result to do something else first, right? As a server, it should receive the request and perform the corresponding operation after receiving it. For example, if I want to query my user information, what NodeJs does is "receive a Post request"-> "execute function findUserDetail (userId)"-> "return user information to the front end". This process seems to have nothing to do with asynchrony?

so why does the server use NodeJs faster than Java when there are a large number of requests (and the amount of computation is small and CPU is not intensive)?

< hr >

for example, in Zhihu | what are the advantages and disadvantages of using Node.js this post, many people have mentioned" better performance in dealing with high concurrency scenarios ".

Source of question: the classmate interviewed the question and found that I couldn"t answer it myself. When I introduce NodeJs to others, I always say "it has a large throughput as a Web server", but I don"t understand it all the time.


you opened an inn and hired five guys. Whenever the guest comes, choose a man to entertain the guest all the time, one-on-one service, until the guest leaves. At this time, the inn can receive up to five guests at the same time.

so he lost money.

you opened another inn and hired five employees, but changed your business strategy. Instead of providing personal service to the guests, each man meets the needs of each guest in order, and then turns to serve the next guest. At present, the maximum number of people received by the inn at the same time is the maximum capacity of the inn.

the cost remains the same and makes a lot of money. I'm so happy.

the former is Java, and the latter is Node. Java uses multithreading to handle concurrency, and Node uses async to handle concurrency.

recommended reading: what is the core essence of high concurrency and high performance in node.js applications?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e81e91-b93.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e81e91-b93.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?