Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PM2 Cluster Mode Load Balancing Discrepancy on Windows #5713

Open
MananShah9 opened this issue Nov 26, 2023 · 1 comment
Open

PM2 Cluster Mode Load Balancing Discrepancy on Windows #5713

MananShah9 opened this issue Nov 26, 2023 · 1 comment

Comments

@MananShah9
Copy link

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.

@MananShah9
Copy link
Author

I am creating a PR to include this info in the readme.

MananShah9 added a commit to MananShah9/pm2 that referenced this issue Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant