Initial knowledge of node (i)

Source: Internet
Author: User

Many people don't know what it is even after they use node, and you should have a preliminary, concrete idea of what to do after reading this article.

Node's goal

Provides a simple way to build a scalable network program. Note that the method of the Scalable network program, that is, node is a way to solve the problem, so let's look at the current problem.

The role of Node

1, the current problem

The current server program, each connection will generate a new thread, each new thread may need 2MB of companion memory. As the number of users rises to a certain level, server costs, traffic costs, and labor costs will increase accordingly. In addition, each request from a user may be used on a different server, so any shared resource must be shared across all servers. So, the current Web application architecture (including traffic, processor, and memory speed) bottlenecks-the maximum number of ice-law connections that the server can handle.

2. Solution

The workaround for Node is to change how you connect to the server. Each connection emits an event that runs in the node engine's process instead of generating a new OS thread for each connection (and allocating some companion memory for it). Node does not allow the use of locks and does not block I/O calls, so there is no deadlock.

How node works

Node itself runs V8 JavaScript, so talk about how it works, well, let's talk about this V8 JavaScript.

The V8 JavaScript engine is the underlying JavaScript engine Google uses for its Chrome browser, and the engine has a huge feature: You can download the engine and embed it in any application, and it's not limited to running in one browser. V8 improves performance by compiling JavaScript into machine code, not bytecode, or interpreting it before running. Further, methods such as inline caching (inline caching) are used to improve performance. With these features, the JavaScript program is comparable to the speed of the V8 engine in binary compilation. So, with such a good engine, node will rebuild it to be able to use it on the server.

Node as a very fire open source project, every day there are a lot of good module generation, and these modules greatly enriched node this product, and will become a key part of it. Such an important module, installing it requires only a simple command--npm,npm as a way to allow easy extension of node functionality without worrying about damaging your node installation.

Summary

Here, you should have a clearer understanding of node, of course, my understanding is that after doing a small project to review the content, the brain has such a cognition. He makes JavaScript such a foreground language, through the use of V8 is very good to go over to the background, and to achieve the goal of its scalable network program. Of course, as an open source project, there will be a lot of trouble in management, in 2014 this year, node has experienced a few, the details of the major node forum should be involved, but the most gratifying should be, node. js goes beyond jquery to become the second most popular open source project on GitHub.

PS: If the contents of this article is wrong or confused, please correct or point out.

Initial knowledge of node (i)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.