Pm2

Hosting· DeploySmith ·

PM2 vs systemd for Node.js

Intermediate · 10 min read

Every Node.js app that survives more than a week in production eventually asks the same question: what keeps it running when it crashes, and what brings it back when the server reboots? Two answers dominate - PM2, a Node-native process manager, and systemd, the init system already living inside virtually every modern Linux distribution. They are not competing at exactly the same layer. PM2 is a userspace daemon you install on top of the OS. systemd is the OS. Understanding where the boundary sits is the difference between a setup that quietly works for years and one that fights you every time you deploy. This guide walks through the real, documentation-backed behavior of each so you can pick deliberately. What each one actually is PM2 is a daemon process manager written for Node.js, installed via npm. You start it with npm install pm2@latest -g, then launch an app with pm2 start app.js. PM2 daemonizes the process, keeps it alive, and gives you a CLI to inspect status, tail logs, and reload the app.[1] Its headline feature for Node is cluster mode: with the -i flag it spans a workload across every available CPU with zero changes to your code.[2] …

Read more →