我们可以使用 PM2 来扩展节点 js 网络服务器吗?港口呢?

Can we use PM2 to scale a node js webserver? What about port?

我的问题还可以回答,但我找不到我的具体问题的准确答案。

假设我有一个简单的 node.js 应用程序,它启动了一个在端口 3000 上列出的网络服务器

是否可以指示 Pm2 在负载过大的情况下自动启动新进程?

如果是,监听端口会怎样?我的意思是:如果我在同一个端口上启动第二个网络服务器,它就无法工作。我们如何在 pm2 中处理这个问题?

也许这个视频可以帮助您找到解决这个问题的方法

https://www.youtube.com/watch?v=6xIbVPyh9wo

The cluster mode allows networked Node.js applications (http(s)/tcp/udp server) to be scaled across all CPUs available, without any code modifications. This greatly increases the performance and reliability of your applications, depending on the number of CPUs available.