nodemon
pm2
https://blog.csdn.net/taokexia/article/details/105571341
https://gitee.com/geektime-geekbang/geek-nodejs/blob/master/chapter4/process/boot.js
cluster模块
nodejs默认是单进程的,但是对于多核的cpu来说, 单进程显然没有充分利用cpu;
所以,node中的cluster模块就是为了解决没有充分利用cpu的问题而产生的
const cluster = require('cluster')const http = require('http')const os = require('os')const {length} = os.cpus(); // cpu个数if(cluster.isMaster) {console.log(`主进程 ${process.pid}正在进行`)for(let i =0; i< length; i++) {cluster.fork() // 衍生工作进程// 如果进程挂掉,5秒后,尝试重启cluster.on('exit', () => {setTimeOut(() => { cluster.fork() }, 5000)})}}// 如果当前不是主进程,那么就启动一个服务器http.createServer((req, res) => {res.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'})res.write('hello world')res.end();}).listen(3030)console.log(`工作进程 ${process.pid}已经启动`)

