You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: