Home > Article > Web Front-end > What are the disadvantages of building a web server with nodejs?
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.
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!