node. js from getting started to giving up "what is node. js"

Source: Internet
Author: User

1. What is node. js

node. JS is a back-end JavaScript runtime environment (supported systems include *nux, Windows), which means you can write system-level or server-side JavaScript code.

node. js is lightweight and efficient with event-driven, non-blocking I/O models, making it ideal for running data-intensive real-time applications on distributed devices.

Two examples of event-driven: see a doctor in the United States, need to fill out a large number of forms, such as insurance, personal information, such as traditional thread-based systems (thread-based system), the receptionist called you, you need to fill in the front desk to complete these forms, You stand and fill the list,
And the receptionist sits and watches you fill out the order. You let the receptionist not be able to receive the next customer unless you finish your business. Want the system to run faster, only a few more receptionists, labor costs need to increase a lot. Events-based system (event-based system), when you go to the window to find that you need to fill out some additional forms rather than just hanging a number, the receptionist will give you the form and pen, tell you can find a seat to fill, and then go back to find him.
You go back to sit and fill in the form, and the receptionist starts receiving the next client. You're not blocking the receptionist's service. You fill out the form, return to the team, wait for the receptionist to finish the present customer, and you pass the form to him. If you have any questions or need to fill out additional forms, he will give you a new one and repeat the process. The system is already very efficient, and almost all of the doctors do it. If you wait too many people, you can join an additional receptionist for service, but certainly much less than based on threading patterns.
The second example is a fast food restaurant ordering food. In a thread-based approach (thread-based way) before you arrive at the counter, give your order to the cashier or order the cashier directly, and wait until you have the food ready for you. The cashier can't receive the next person unless you get the food and leave.
Want to receive more customers, easy! Add more Cashiers! Of course, we know that fast food restaurants do not actually work like this. They are actually based on the event-driven approach, so the cashier is more efficient. As long as you give your order to the cashier, someone has started to prepare your food, while the teller is collecting money, and when you have paid,
You stand aside and the cashier has already started to receive the next customer. In some restaurants, you'll even get a number, and if your food is ready, call your number and let you go to the counter. The key point is that you are not blocking the next customer's order request.
function).

2. What are the advantages of JavaScript running on node compared to other back-end development languages?

The biggest advantage is that JavaScript's natural event-driven mechanism adds V8 high-performance engines, making it easy to write high-performance Web services.

node. js from getting started to giving up "what is node. js"

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.