Websockets with multiple passenger instances constantly reconnecting

100 views
Skip to first unread message

t...@salonkee.lu

unread,
Nov 25, 2016, 4:33:53 PM11/25/16
to Phusion Passenger Discussions
Hi everybody,

I' using Passenger standalone (Node.js) behind an Nginx proxy. Nginx is configured based on the official documentation (https://www.phusionpassenger.com/library/deploy/standalone/reverse_proxy.html).

If passenger is running with 1 instance, every works fine.

However if I start passenger with "--min-instances" equal to 2 or higher, my websockets are constantly losing connections (and reconnecting). I guess this is based on the face that the load is distributed between the different passenger instances and the websockets do not stick to the same instance?

If that's the case, I found the following regarding sticky session in NGINX (http://socket.io/docs/using-multiple-nodes/). However it seems to me that the latter is only applicable if the different instances would run on different ports? 

Or maybe I'm missing something trivial?

Thanks for any help.

Best,

Tom

Daniel Knoppel

unread,
Nov 27, 2016, 4:03:23 PM11/27/16
to Phusion Passenger Discussions

In short, Passenger takes care of the load balancing between your application processes, so you need to configure sticky sessions on Passenger (and not Nginx).

- Daniel
Reply all
Reply to author
Forward
0 new messages