Performance: PM2 for process management
PM2 affects server uptime and responsiveness by managing Node.js process restarts and load balancing, impacting backend response times and stability.
pm2 start server.js --name my-app
node server.js
| Pattern | Process Management | Downtime | Load Handling | Verdict |
|---|---|---|---|---|
| Manual node start | No management | High downtime on crash | No load balancing | [X] Bad |
| PM2 with single process | Auto restart | Minimal downtime | No load balancing | [!] OK |
| PM2 cluster mode | Auto restart + load balancing | Near zero downtime | Efficient CPU usage | [OK] Good |
PM2 with an Express application?app.js using PM2?pm2 start <file>.pm2 start app.js matches the correct syntax.pm2 start app.js --name myapp pm2 restart myapp pm2 stop myapp pm2 delete myapp
pm2 start app.js --name myapp starts the app named 'myapp'.pm2 restart myapp restarts it.pm2 stop myapp stops the app but keeps it in PM2 list.pm2 delete myapp removes the app from PM2 list and stops it completely.pm2 start app.js, but it immediately stops. Which of the following is the most likely cause?app.js is a common cause for immediate crash and stop.-i or --instances to specify how many app instances to run. Using -i max runs as many instances as CPU cores.--instances 1 runs only one instance.--scale and --multi are not valid PM2 options.Pass the test and this pattern moves unknown