I heard the reason that MongoDB and other Node.js programs are fast is because they do everything at the same time with async, but when I run a Node program, I only see one thread on my system. What's wrong? Have they not finished this feature yet? If not, how can this be faster than PHP/Apache, where they will run many threads instead of wasting system resources sitting idle?
Asked
Active
Viewed 174 times
0
-
1Threads have nothing to do with asynchrony. You need to read http://blog.slaks.net/2014-12-23/parallelism-async-threading-explained/ – SLaks Sep 07 '15 at 00:24
-
I do love the question though. – Robert Moskal Sep 07 '15 at 00:25
3 Answers
1
async is not the same as multi thread. those are two different things.
Asynchronous means that the thread doesn't need to wait for the response of a function call before doing other things. you can however mix async with multi threading but that does not mean that they are the same.

taxicala
- 21,408
- 7
- 37
- 66
1
Asynchronous programming does not necessarily mean multi-threaded.
Asynchronous only means that the data can be transmitted intermittently rather than in a steady stream.
For example, Javascript is a single-threaded runtime that make use of Asynchronous Communication.

Marco x
- 21
- 3
0
You can have multiple processes and/or workers in node.js too.

Community
- 1
- 1

Chong Lip Phang
- 8,755
- 5
- 65
- 100