Node JS Architecture
Node.js is a single threaded model and it uses JavaScript event looping for processing.
- NodeJS Web Server will get request from a client
- In order to provide service to a request, Server maintains a pool.
- Requests are placed in a queue named Event Queue.
- Now the requests are processed using a JavaScript event loop.
- It is a Single Threaded model and used for processing the request.
- Event loop processes the request in the event queue and response is sent to the client.
- In case of any I/O operation like fetching data from DB then it uses different mechanisms to process those requests.
- Here threads are responsible to perform those actions and send them back to event loop.
- And then the event loop will respond to the client.