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
Sometimes we may store session in memory store or just in local variables (for example, sockjs's MAP variable, and the author seems do not plan to add a redis store),
So I need ensure people visit a single process by every request.
By now my solution is separate applications in multi ports and use nginx ip_hash to proxy request to their node process.
This works well but I wonder if pm2 support this feature in cluster mode, it would be only one port in use, and pm2 will be more powerful and graceful.
Just a proposal.
Cheers.
The text was updated successfully, but these errors were encountered:
I doubt that. pm2 is built around node.js cluster module, and it doesn't seem to be supporting this thing. Maybe open a feature request against joyent/node or something.
Can you start your app on different ports and use nginx for this as usual?
I think that sticky connections will never be implemented in the cluster module. NodeJS apps must be stateless and data must be shared via a database.
The workaround is what @AwotwiJ says, just start your app on different port and do the balancing via Nginx
Sometimes we may store session in memory store or just in local variables (for example, sockjs's MAP variable, and the author seems do not plan to add a redis store),
So I need ensure people visit a single process by every request.
By now my solution is separate applications in multi ports and use nginx ip_hash to proxy request to their node process.
This works well but I wonder if pm2 support this feature in
cluster mode
, it would be only one port in use, and pm2 will be more powerful and graceful.Just a proposal.
Cheers.
The text was updated successfully, but these errors were encountered: