Home > Web Front-end > Front-end Q&A > What are the disadvantages of building a web server with nodejs?

What are the disadvantages of building a web server with nodejs?

青灯夜游
Release: 2022-01-13 16:45:34
Original
2620 people have browsed it

Disadvantages of building a web server with nodejs: 1. Nodejs is single-threaded and cannot perform CPU-intensive operations, resulting in time slices not being released and blocking subsequent tasks; 2. Nodejs reliability is relatively low; 3. Using multi-core performance When doing this, you need to use a cluster or deploy multiple instances, which is troublesome and so on.

What are the disadvantages of building a web server with nodejs?

The operating environment of this tutorial: windows7 system, nodejs version 12.19.0, DELL G3 computer.

The advantages and disadvantages of Nodejs as a web server

Disadvantages:

1.nodejs single thread , CPU-intensive operations cannot be performed, resulting in time slices not being released and subsequent tasks blocked.

2. The reliability of nodejs is relatively low. An error reported in one place will cause the entire program to crash, and the daemon process or docker restart is required to solve the problem.

3. When using multi-core performance, you need to use a cluster or deploy multiple instances, which is more troublesome.

4. The default memory is 0.7G and 1.4G. If the setting is larger, garbage collection will slow down, and you may need to deploy several more instances.

5. The nodejs type backend is more difficult to recruit. You need to convert the front end to the back end or the back end to nodejs.

Advantages:

1. Nodejs underlying asynchronous io has better performance.

2. Don’t worry about threading when writing.

3. The development speed is high, and the weakly typed language is more flexible. It does not require various conversions like the strong type, and the amount of code is small.

4. It is more convenient to apply SSR on a single page, and the context is relatively the same.

5. Converting the front-end to nodejs is relatively natural and proficient in grammar.

For more node-related knowledge, please visit: nodejs tutorial! !

The above is the detailed content of What are the disadvantages of building a web server with nodejs?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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 admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template