Do you know Node.js? If you don’t understand, you can give it a try. This article will briefly introduce Node.js through 7 questions. I hope it will be helpful to everyone!
1. In what year was Node born?
The birth of Node2009
年
In March 2009, the author of Node announced on his blog that he was preparing to create a lightweight based on V8 Web server and provides a set of libraries
In May of the same year, the initial version was released on GitHub
In July 2011, the windows version was released with the support of Microsoft
2. Who created it?
Ryan Dahl
is the creator of Node and is known as the father of Node
But in January 2012, Ryan Dahl will take the helm The identity of the person was transferred to Isaac Z.Schlueter, who accepted Node's version release and bug fixing work. Isaac Z.Schlueter was also the later author of NPM
3. Why is it called Node?
Node has many nicknames, such as Nodejs, NodeJS, Node.js, etc. So why is Node?
At first, Ryan Dahl called his project web.js, which is a web server, but the development of the project exceeded his original idea of simply developing a web server. It has become a basic framework for building network applications, and more things can be built on it, such as servers, clients, command line tools, etc. Node was developed as a single-threaded, single-process system that enforces no sharing of any resources. It includes network-friendly libraries and provides infrastructure for building large-scale distributed applications. Its goal is also known as a service for building fast and scalable network applications. . It itself is very simple. It organizes many Nodes through communication protocols and is very easy to expand to achieve the purpose of building large-scale network applications. Each Node process constitutes a node in this network application, this is exactly the meaning of Node
4. Why JavaScript became the implementation language of Node ?
There are three main reasons for choosing JavaScript as the implementation language of Node:
Ryan Dahl has evaluated C, Lua, Haskell, Ruby, etc. as alternative implementations, However, the development threshold for C is high, Lua has a lot of historical baggage, Haskell feels that it is still not good enough, and the performance of Ruby's virtual machine is not very good. After all, JavaScript was chosen as the implementation language of Node
You may think like me, does JavaScript have no historical baggage? Yes, JavaScript has never had a market in the back-end, and its historical baggage is equivalent to zero
5. What are the main features of Node?
The main features are:
Node retains the familiar interfaces in front-end browser JavaScript without rewriting any features of the language itself
6. What are the application scenarios of Node?
The main application scenarios of Node are as follows:
Node uses the processing power of the event loop and does not need to start a thread for each request, thus making it easier to Effectively organize more hardware resources; for businesses that focus on CPU stack operations, Node's performance is also efficient enough, mainly due to V8's deep performance optimization
7. CPU intensive What challenges will type applications bring to Node, and how to solve them?
The main challenge that CPU-intensive applications will bring to Node is: since JavaScript is single-threaded, if it is calculated for a long time (such as a large loop), the CPU time slice will not be released. , making it impossible to initiate subsequent I/O
Usual solution:
If the above solution cannot be solved, Node will still There are two ways to make full use of the CPU
For more node-related knowledge, please visit: nodejs tutorial! !
The above is the detailed content of A brief introduction to Node.js through 7 questions. For more information, please follow other related articles on the PHP Chinese website!