Nodejs advantages and appropriate programs to develop _node.js

Source: Internet
Author: User

Many students may have heard of Nodejs, and know that he is able to run on the server JavaScript, but his use of the scene may not be very clear, and recently also looked at learning Nodejs, did a little summary;

Advantages of Nodejs:

Now a lot of server-side language (php,java,asp.net), what's the problem, now the server-side language when the user accesses the server, creates a thread for each user link, but each thread consumes about 2M of RAM, if a 8G-RAM server, You can also link 4,000 or so users, if the user's large number of links, you must increase the number of servers, and now the user's links have a lot (such as app, Web Access at the same time), which is related to the problem of server sharing, so the server how to support the largest amount of simultaneous link user has become a problem;

Nodejs modified the client to server-side link method to solve this problem, he does not create a new thread for each client, but for each client link to start a nodejs internal processing of events, so Nodejs has the ability to handle up to tens of thousands of users of client links;

Nodejs Applications for Development:

When an application needs to handle a large amount of concurrent input/output, and before a response is made to the client, there is no need for very complex processing within the application, we should consider using Nodejs for application development, for example:

1, Chat server: If chatting a lot of people, the user and the server between the concurrent link volume is very large, but the server-side data processing is not complex;

2, the Integrated Services Web site and E-commerce Web site server: In such a Web site, the server side, often can be stored within a second to accept up to thousands of data and need to write the data into the database, Nodejs can through its queuing mechanism to quickly write the data into the buffer, The data is then removed from the cache by each individual process and written to the database, in the case of other servers (such as Apache servers or tomcat servers), because these servers are using blocking I/O mechanisms, So each piece of data is written to the database for a period of time (when the last one is written, to write the next one), but Nodejs uses a non-blocking I/O mechanism, so that the data can be written to the database without having to wait for the writing of each piece of data for a period of time;

Summarize:

A slightly larger system is not a development language can be done, often several mixed together, such as C, C + + server-side development, Java to do business logic, PHP, etc. do front-end display, in addition to the need for message middleware and so on.

Nodejs can be quickly on the server side of the prototype (originally only C and Java can do things, performance is still very high), and the amount of code is relatively much less; another point is its grammatical advantages, JS closures and so on. But it is not very suitable for CPU-intensive work, only around the bend to solve, it is said this qcon will be someone to share the research results, you can pay attention to.

Each language has its suitable field, there is no need to insist that a language can solve everything, have other language characteristics, only the constant tradeoff the system to make the goal.

These are summarized in a series of books, and I also look at

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.