Seminar PPT
Seminar PPT
Internals of Node.JS
Agenda:
Introduction
Conclusion
References
What is Node JS ?
Node.js is a JavaScript runtime environment that is used for building web applications, including
the backend and frontend components. It's used for a variety of purposes, including:
• Real-time applications: Node.js is often used to develop real-time applications because of its
asynchronous, event-driven nature. This allows it to handle heavy input-output operations,
which is important for real-time applications.
• Single-page applications and dynamic websites: Node.js can handle multiple requests
asynchronously, which allows it to serve dynamic content to users.
• Scalability: Node.js applications can be easily scaled vertically and horizontally. Vertical
scaling allows you to add more resources to the current nodes, while horizontal scaling
allows you to add new nodes quicker.
Understanding the V8 Engine
JavaScript Runtime
Node.js utilizes the V8 engine as its JavaScript runtime
environment, providing a platform for executing JavaScript code
outside of a web browser.
Server-side JavaScript
V8's integration into Node.js enables the execution of JavaScript
code on servers, facilitating the development of back-end
applications.
Asynchronous Programming
Node.js leverages V8's support for asynchronous programming,
allowing for efficient handling of I/O operations and concurrent
tasks.
The Role of Libuv in Node.js
What is Libuv ?
Libuv is an open-source library that provides the core asynchronous I/O functionality for Node.js. It
allows Node.js to handle non-blocking operations, enabling high concurrency without needing
multithreading..
Phase 1: Timers
Executes callbacks for timers that have expired.
Phase 3: SetImmediate
2 Process Events
If events are found, the event loop executes the
appropriate callbacks associated with those events.
3 Repeat
The event loop continuously repeats these steps, ensuring
that events and tasks are handled in a timely manner.
Microtasks and Macrotasks
The event loop distinguishes between different types of tasks, categorizing them as microtasks and macrotasks.
Microtasks Macrotasks
High priority tasks such as promises, Lower priority tasks, such as timers, I/O operations, and
process.nextTick(), and queueMicrotask(). setImmediate().
Asynchronous I/O with
Libuv
Non-Blocking Callbacks and Promises
Operations Node.js uses callbacks or
Libuv allows Node.js to Promises to handle
perform I/O operations asynchronous I/O results,
without blocking the main enabling efficient handling
thread, ensuring of multiple operations
responsiveness and high concurrently.
throughput.
1 Single-Threaded Model
Node.js utilizes a single thread to handle all operations,
leveraging asynchronous I/O for concurrency.
https://zmushegh.medium.com/understanding-
libuv-the-powerhouse-behind-node-js-b5349c8f
0d75
THANK
YOU !!
Any Questions ?