Home > Web Front-end > JS Tutorial > body text

What is Node.js? What are the advantages? what is it used for?

青灯夜游
Release: 2020-08-31 10:05:17
forward
4062 people have browsed it

What is Node.js? What are the advantages? what is it used for?

1. Introduction to Node.js

Node.js is a javascript running environment . It allows JavaScript to develop back-end programs and achieve almost all functions implemented by other back-end languages, and can be on an equal footing with back-end languages ​​such as PHP, Java, Python, .NET, and Ruby. [Video tutorial recommendation: nodejs tutorial]

Nodejs is based on the V8 engine. V8 is an open source JavaScript engine released by Google. It itself is the js interpretation part for the Chrome browser, but Ryan Dahl This guy, like a genius, moved this V8 to the server and used it to make server software.

2. Advantages of node.js

1. Nodejs syntax is completely js syntax, as long as you understand the basics of js. Learn Nodejs back-end development

Node breaks the past situation where JavaScript can only run in the browser. The unified front-end and back-end programming environments can greatly reduce development costs.

2. The super high concurrency capability of NodeJs

The primary goal of NodeJs is to provide a simple method for creating high-performance servers and can be used in the server. Development tools for running various applications.

First let us take a look at what problems exist in current server-side languages. In server languages ​​such as Java, PHP or .NET, a new thread is created for each client connection. Each thread requires approximately 2MB of memory. In other words, theoretically, the maximum number of users that can be connected to a server with 8GB of memory at the same time is about 4,000. In order for a web application to support more users, the number of servers needs to be increased, and of course the hardware cost of the web application increases.

NodeJs does not create a new thread for each client connection, but only uses one thread. When a user connects, an internal event is triggered. Through non-blocking I/O and event-driven mechanisms, the Node.js program is macroscopically parallel. Using Node.js, a server with 8GB of memory can handle the connections of more than 40,000 users at the same time.

3. Implementing high-performance servers

Strictly speaking, Node.js is a development tool used to develop various web servers. In the Node.js server, the high-performance V8 JavaScript scripting language is running, which is a scripting language that can run on the server side.

So, what is the V8 JavaScript scripting language? This language is a scripting language that is parsed and executed by the V8 JavaScript engine. The V8 JavaScript engine is a high-performance JavaScript engine developed by Google using the C language. The engine is not limited to running in the browser. Node.js transfers this to the server and provides it with many additional APIs for various purposes. For example, in a server, it is often necessary to process various binary data. In the JavaScript scripting language, there is only very limited processing capability for binary data, while the Buffer class provided by Node.js provides rich processing capabilities for binary data.

In addition, a new compilation technology is used inside the V8 JavaScript engine. This means that the high-end JavaScript script code written by developers has very similar execution efficiency to the low-end C language written by developers. This is also an important feature that the Node.js server can provide.

4. Short development cycle, low development cost, and low learning cost

Node.js’ own philosophy is to minimize hardware costs and pursue higher concurrency. Higher processing performance.

3. What can Node.js do

Look at the picture:

##More For more programming related knowledge, please visit:

Introduction to Programming! !

The above is the detailed content of What is Node.js? What are the advantages? what is it used for?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!