@miqro/runner
v2.0.3
Published
cluster manager. forks workers and restarts on crash.
Readme
@miqro/runner
cluster manager. forks workers and restarts on crash.
cli
npx miqro-runner server.js
npx @miqro/runner server.js
CLUSTER_COUNT=4 npx miqro-runner server.js
CLUSTER_DISABLE_RESTART=true npx miqro-runner server.js
CLUSTER_AUTO_BROADCAST=true npx miqro-runner server.jsenvironment variables:
CLUSTER_COUNT number of workers (default: os.cpus().length)
CLUSTER_DISABLE_RESTART disable auto-restart on crash (default: false)
CLUSTER_AUTO_BROADCAST broadcast IPC messages to all workers (default: false)workers get CLUSTER_NODE_NUMBER env var (0..n-1).
notes
- worker 0 is the primary worker — use for one-time operations
- workers restart after 10ms on crash — no backoff
- a crash loop will peg CPU — add crash detection in your app if needed
- SEA binaries cannot use
@miqro/runner— no Node.js to fork with
