sails.js multiple child process, what are those? Ubuntu

By running sails with forever or calling it directly with node app.js --prod, according to htop i have a 4 child process that look like clones under it.

If i leave out the --prod argument, i get an equal quantity of grunt processes. As you can see they all have the same amount of memory used, different PID and different TIME+ readings.

I'm pretty sure sails its not auto clustering, or is it? This is a single core machine (virtual), so i have no idea what are those processes, or is it an error in htop?

According to this question htop-showing-multiple-java-processes-with-different-pids?rq=1

htop shows threads as different process, but isn't node single threaded? If those are threads where are they comming from?

Answers


The threads you see using htop is userland threads(user's thread) but when you run your application in cluster mode(say 4 instances),it makes kernel thread. more on user threads

when you hide userland threads then whatever you see is kernel thread.while running application in cluster mode you will create multiple kernel threads of an application.And for each application's kernel thread there are several userland threads associated with it.

(for htop you can hide userland thread by F2 and display options)

please see the screen shots for explanation.

four instances of my app in cluster mode since number of cores==4

ps commands showing kernel threads only

htop showing kernel threads only

htop showing kernel threads along with userland threads

In last screenshot you see a few kernel and userland's threads but there are more. I mean for each kernel thread there are some userland's thread associated with it.


Need Your Help

How to parse log4net log-files?

.net parsing logging log4net

I am using log4net for logging. Is there any straightforward way to parse result files?

Parser syntax errors when trying to install Rails

ruby-on-rails

I'm getting a ton of errors trying to install Rails 3.1.1. The error looks something like this: