Origin and characteristics of Node.js?

Author : xuzhiping   2022-11-25 16:16:03 Browse: 1179
Category : JavaScript

Abstract: Node.js is a running environment that can parse and execute JavaScript code on the server. It can also be said to be a runtime pla...

Node.js is a running environment that can parse and execute JavaScript code on the server. It can also be said to be a runtime platform. It still uses JavaScript as the development language, but it also provides some functional APIs, such as file operation and network communication APIs.

Node.js is the first version launched by Ryan Dahl in May 2009. Ryan Dahl is an optimization expert who focuses on the implementation of high performance late Web servers. He transplanted the V8 engine of Chrome browser separately. On this basis, he provides a friendly API for JavaScnpr on its upper layer for developers to use, and it is completely open source and free of charge.

Characteristics and advantages of Node.js

Node.js

Node.js an emerging back-end language platform designed to help programmers quickly build scalable applications. With a lot of attention from developers since its release, Node.js is so popular thanks to some of its attractive features.

The details are as follows:

(1) It is a JavaScript running environment: Node.js as a running environment allows JavaScript to be executed separately from the browser and on the server side, and if the client and server side use the same development language, it can largely achieve the common code of the client and the tenant side.

(2) Rely on Chrome V8 engine for code parsing: Chrome V8 is responsible for parsing JavaScript code without browser parsing.

(3) Event-Driven: For event encryption, in the initial stage of learning JavaScript, you will be exposed to events, such as onclick, onload, etc., these events are usually bound to a page element, and then specify an event handler for it, and the corresponding handler will be executed when the event is triggered. It can be said that such an event-handling mechanism is a standard event-driven mechanism.

(4) Non-blocking I/O (non-blocking L/O): When it comes to non-blocking I/O, it is necessary to understand the blocking L/O, I/O (Input/Output) means input/output operation, and blocking chamber I/O can be understood as blocked input/output operation. There are many operations that will involve blocking LO on the server side, such as in the process of reading a file, you need to wait for the file to be read before continuing the following operations, Node.js uses event homology to solve this blocking l/O situation, avoiding the wait required to block I/O, so it has the characteristics of non-blocking l/O.

(5) Lightweight, scalable, suitable for real-time data interaction applications: In Node.js, Sockets can achieve two-way communication, for example, chat rooms are real-time data interaction applications.

(6) Single process, single thread: The process is an execution process of an application, which is a dynamic concept: and the thread is part of the process, and the process contains multiple threads running. Single thread is only one thread in the process, blocking 1/O mode a thread can only process one task: non-blocking 1/O mode, a thread is always processing tasks, so that CPU utilization is 100%, Node.js uses a single thread, using event-driven asynchronous programming mode, to achieve non-blocking I/O.

Label :
    Sign in for comments!
Comment list (0)

Powered by TorCMS (https://github.com/bukun/TorCMS).