0% found this document useful (0 votes)
9 views

Introduction

Node.js is an open-source, cross-platform JavaScript runtime environment that executes code outside a web browser, designed by Ryan Dahl and released in 2009. It operates on a single-threaded model, handling requests asynchronously, which allows it to use fewer resources compared to traditional web server models that rely on dedicated threads. However, Node.js is not suitable for CPU-intensive applications due to potential blocking of the single thread during heavy computations.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Introduction

Node.js is an open-source, cross-platform JavaScript runtime environment that executes code outside a web browser, designed by Ryan Dahl and released in 2009. It operates on a single-threaded model, handling requests asynchronously, which allows it to use fewer resources compared to traditional web server models that rely on dedicated threads. However, Node.js is not suitable for CPU-intensive applications due to potential blocking of the single thread during heavy computations.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Introduction

Node JS
Formatted Output

var a="yogesh:"
var age=32
console.log("%s age is %d",a,age)
console.log(`${a} age is ${age}`)
Node.js is an open-source, cross-platform, back-end, JavaScript runtime environment
that executes JavaScript code outside a web browser. Node.js lets ...Original author(s):
Ryan Dahl
Written in: C, C++, JavaScript
Initial release: May 27, 2009;
Traditional Web Server Model
In the traditional web server model, each request is handled by a dedicated
thread from the thread pool. If no thread is available in the thread pool at any
point of time then the request waits till the next available thread. Dedicated
thread executes a particular request and does not return to thread pool until it
completes the execution and returns a response.
Node.js Process Model

Node.js runs in a single process and the application code runs in a single thread and thereby needs
less resources than other platforms. All the user requests to your web application will be handled by a
single thread and all the I/O work or long running job is performed asynchronously for a particular
request. So, this single thread doesn't have to wait for the request to complete and is free to handle
the next request. When asynchronous I/O work completes then it processes the request further and
sends the response.
Drawbacks

Node.js is not fit for an application which performs CPU-intensive


operations like image processing or other heavy computation work because
it takes time to process a request and thereby blocks the single thread.

You might also like