How nodejs works?

How nodejs works?

Need to hire an IT company?

Post your project

in 5 minutes for free

seoagensy

How nodejs works?

on Web Developers at Aug 12, 2020 09:54

I don't understand several things about nodejs. Every information source says that node.js is more scalable than standard threaded web servers due to the lack of threads locking and context switching, but I wonder, if node.js doesn't use threads how does it handle concurrent requests in parallel? What does event I/O model means?

Your help is much appreciated. Thanks

Re: How nodejs works?

on Web Developers at Aug 13, 2020 10:43

Node is completely event-driven. Basically the server consists of one thread processing one event after another.

A new request coming in is one kind of event. The server starts processing it and when there is a blocking IO operation, it does not wait until it completes and instead registers a callback function. The
server then immediately starts to process another event (maybe another request). When the IO operation is finished, that is another kind of event, and the server will process it (i.e. continue working on the request) by executing the callback as soon as it has time.So the server never needs to create additional threads or switch between threads, which means it has very little overhead. If you want tomake full use of multiple hardware cores, you just start multiple instances of node.js
This forum thread discusses How nodejs works?. You can join the discussion by clicking on 'Post a reply'. If you are new to Web Developers Forum, you will need to sign up and create a new account.

How nodejs works? related posts on Web Developers Forum

Can drupal run on windows?

by seoagensy on Web Developers

drupal

by Danavero Inc on Web Developers

What is web application development?

by Finbyz Tech Pvt. Ltd. on Web Developers

Reply on this threadPost a reply
Loading...