Technology
V8 Runtime Environment
Google’s V8 engine is an open-source Just In Time, or JIT,
compiler written in C++.In recent benchmarks, V8’s performance has surpassed other JavaScript interpreters including SpiderMonkey and Nitro. It has additionally surpassed PHP, Ruby and Python performance. Due to Google’s approach, it is predicted that in fact it could become as fast as C. The engine compiles JavaScript directly into assembly code ready for execution by avoiding any intermediary representations like tokens and opcodes which are further interpreted. The runtime environment is itself divided into three majors components: a compiler, an optimizer and a garbage collector.
Libuv
The C++ Libuv library is responsible for Node’s asynchronous I/O operations and main event loop. It is composed of a fixed-size thread pool from which a thread is allocated for each I/O operation. By delegating these time-consuming operations to the Libuv module, the V8 engine and remainder of NodeJS is free to continue executing other requestsDesign Patterns
Node relies heavily on1. Object Pool
2. Facade
3. Factory Design Patterns
NPM
The Node package manager, denoted npm, is the official package manager for NodeJS, written entirely in JavaScript. It comes bundled and installed automatically with the Node environment. It is responsible for managing dependencies for the Node application and allows users to install applications already available on the npm registry. Npm was initially developed in 2010 with the immediate goal for quick integration into the NodeJS platform.Official site : https://www.npmjs.com/
Internal Structure of Nodejs.
The internal structure of NodeJS. The main, single thread handles all incoming requests concurrently. All components are single-threaded, promote asynchronous behavior, and are able to interface with one-another. All connections are highspeed and enabled through streams of data.
Architectural Style of Nodejs.
The various interactions between NodeJS platform components during a single Node instance. This demonstrates where how the event loop delegates tasks to a thread allocated by the Libuv library and allows for an asynchronous solution. below is the reference diagram.
This example depicts a simple example of a Node JS request to access data from a database. Here, the platform acknowledges the request immediately before writing or reading any data.
Above data provided are written in reference to An Inside Look at the Architecture of NodeJS by Benjamin San Souci McGill University .
Hey, thanks for this amazing article. I would love to read more of these blogs.
ReplyDeleteNode JS Online training
Node JS training in Hyderabad