Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Will multiple NodeJS apps run on different cores?

Let’s say I have a server with 2 CPU cores, then I launch 2 NodeJS apps. Since NodeJS is single-threaded, will those two nodeJS apps run on different cores or will they run on the same core?

For further information, I’d like to scale up my Socket.IO server. So I want to run two instances of this Socket.IO server without clustering. I worried even if I launched two instances of them it won’t utilize all the cores.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

will those two nodeJS apps run on different cores or will they run on the same core?

You’re running two different processes. Scheduling where they run is up to your operating system. Yes, they’ll use different cores. It’s no different than multiple instances of any other executable.

Since NodeJS is single-threaded…

This is a bit of a myth, and not applicable for most Node.js applications. Your JavaScript runs single-threaded, sure, but all of the I/O and everything in the native modules can be multithreaded.

You can test this yourself easily, to get an idea for what the load looks like for your specific application. It all depends on what you’re doing, specifically.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading