Many people on the internet support nodejs, but as we all know, node’s advantage lies in io concurrency and it is single-threaded. if there are too many visitors and the logic is a bit complicated, can node handle it?
First of all, in a process, the code you write seems to be single-threaded, but all IO operations (file read and write, network requests, etc.) issued inside it are not single-threaded. For example, N asynchronous requests are issued at the same time, and each of these N asynchronous requests has a separate thread. The main thread only polls and processes these successful callbacks.
Secondly, with pm2, your program can copy out N identical processes on a server, thus realizing multi-process operation.
At present, our online API interface runs on 2 8 stone servers. Each server starts 8 API processes plus 10 background service processes through pm2, and can process 500-600 requests per second through load balancing, which is 30 million in a day.