Back to Engineering Blog
DevOps5 min read

Zero-Downtime Atomic Swaps with PM2 Cluster and Nginx Edge

How ServerLaas deploys new application releases with zero dropped HTTP requests using graceful SIGINT process recycling.

Alex Rivera
Alex Rivera
Site Reliability Engineer • Published July 26, 2026

Deploying updates to a live production application without dropping a single active HTTP connection requires careful orchestration between the web server reverse proxy (Nginx) and process manager (PM2).

Graceful SIGINT Handling with PM2

When pm2 reload is called, PM2 spawns new application instances on new ports, waits for them to pass initial health checks, and then gracefully sends SIGINT to old workers allowing active HTTP requests to complete before termination.

javascript
// ecosystem.config.js
module.exports = {
  apps: [{
    name: 'serverlaas',
    script: 'node_modules/next/dist/bin/next',
    args: 'start',
    instances: 'max',
    exec_mode: 'cluster',
    kill_timeout: 5000
  }]
};

Related Articles

Architecture

Why We Chose Single-Table Design for Our Database

August 2, 20268 min read