The part of node that is single threaded is the JS execution. All of the
async calls like I/O and most system calls are handled by a combination of
a thread pool and the OS's scheduler.

If your app mostly just passing data around and not doing a lot of
processing on it then it is certainly a possibility that you are saturating
the CPU cores with these other operations.

Another contributing factor could be native add-ons, which have direct
access to the thread pool and can run their own threads for out-of-band
execution. Examples would be performing crypto operations or database query
serialization and deserialization.

And just to cover all the bases, you didn't actually say that it was your
node process that was using the CPU. Unless you're looking at a docker
container, your system is going to have many other processes running on it
at the same time which could be monopolizing the other cores.

~Ryan

On Wed, Jul 20, 2016, 7:46 AM harsh atal <harsh.a...@gmail.com> wrote:

> Dear All
>
> I have a nodejs application that gets data from one server and pushes into
> another. It is a simple app made using following modules - Q, moment,
> express,request and log4js
>
> For testing I sent 1000 requests to my node server and saw what happens on
> the system monitor. There I could see that all 4 processors were 100%
> occupied.
>
> Now, from what I have read on nodejs, it seems that it by default uses
> only 1 thread(which amounts to 1 processor?). But how come all my
> computer's processors were occupied? Is this load balancing happening at OS
> level(I am on ubuntu 14)
>
> And in case the balancing was done by OS then what is the difference
> between this automatic OS level load balancing and explicitly using
> clusters to divide the load??
>
> Any help would be deeply appreciated :)
>
> Thanks
> harsh
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+unsubscr...@googlegroups.com.
> To post to this group, send email to nodejs@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/be8cae17-841e-47e6-b74e-68ed3a151480%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/be8cae17-841e-47e6-b74e-68ed3a151480%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

~Ryan

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAGjmZGz_T1JkisNvj1iAp1Z27M9j1NRrpf3q92Mro3exKDJSdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to