Request delay during graceful reload in PM2 cluster mode
0 reputation · 05 Mar 2024, 21:18 UTC
Request delay during graceful reload in PM2 cluster mode
When PM2 is configured in cluster mode (e.g., pm2 start app.js -i 0), a surge of concurrent requests can trigger noticeable latency spikes. The built‑in round‑robin load balancer distributes traffic across worker processes, and the absence of sticky session support forces stateful requests to hop between workers, potentially adding context‑switch overhead.
PM2’s graceful reload mechanism, designed for zero‑downtime restarts, can momentarily drop or delay requests when workers are being replaced. This behavior is documented in the PM2 release notes and may become prominent only under heavy, bursty traffic.
Because sticky sessions are not provided out of the box, the decision to implement custom session affinity remains unresolved. The impact of this missing feature on latency under concurrent loads is unclear.
- Under what circumstances does PM2’s graceful reload introduce measurable request delays during high concurrency?
- Does the lack of sticky session support in PM2 cluster mode contribute to the observed latency spikes when stateful sessions are involved?
- What evidence shows that the round‑robin distribution in PM2 cluster mode causes uneven load during bursty traffic, and how can this be quantified?