Open MananShah9 opened 9 months ago
I am creating a PR to include this info in the readme.
Same issue on MacOS
OS: Sonoma 14.4.1 (23E224) PM2 version: 5.4.2
Works great on Linux, but on Mac OS all requests are going to the same process of a cluster. Balancer round robin distribution is not working as expected
What's going wrong?
When utilizing PM2 in cluster mode on Windows servers, we observe a significant discrepancy in load balancing behavior compared to its behaviour on Linux. Unlike the expected round-robin load balancing on Linux, all incoming requests are directed to a single instance of the application on Windows,
How could we reproduce this issue?
On windows create a nodejs app that prints instance id. index.js: `const express = require('express'); const process = require('process'); const app = express(); const port = 3000;
app.get('/', (req, res) => { const instanceInfo = { message: 'Hello, this is Express app!', instanceId: process.pid, }; res.json(instanceInfo); });
app.listen(port, () => { console.log(
Server is running on port ${port} with PID ${process.pid}
); });`Start multiple instances using pm2
pm2 start index.js.js -i 4
Call this API parallelly in multiple tabs. You will always get same instance id.