3 ms·
Does this support sticky sessions? Normally I think it's best for HTTP backends to be stateless, but WebSockets open up interesting possibilities for RPC solut
by tlrobinson 14y ago
Does this support sticky sessions?
Normally I think it's best for HTTP backends to be stateless, but WebSockets open up interesting possibilities for RPC solutions like NowJS (https://github.com/Flotype/now https://github.com/Flotype/now), dnode (https://github.com/substack/dnode https://github.com/substack/dnode), and others (https://github.com/kriskowal/q-connection https://github.com/kriskowal/q-connection) that benefit from keeping state in memory in the app servers.
I'd be interested to hear about other load balancing techniques for WebSockets.
- runesoerensen 14y agoI'd expect the ip_hash directive to work as usual http://wiki.nginx.org/HttpUpstreamModule#ip_hash http://wiki.nginx.org/HttpUpstreamModule#ip_hash although it's not exactly sticky sessions. There's a separate module for that https://github.com/michaelneale/nginx-sticky-module https://github.com/michaelneale/nginx-sticky-module
- mattyb 14y agoHAProxy can, reportedly, load balance WebSocket connections: http://blog.exceliance.fr/2012/11/07/websockets-load-balancing-with-haproxy/ http://blog.exceliance.fr/2012/11/07/websockets-load-balanci... dotCloud's Hipache also looks like it was basically written to solve this problem: https://github.com/dotcloud/hipache https://github.com/dotcloud/hipache
- jabr 14y agoWebSockets are persistent connections, not a state-management trick spanning multiple connections/requests. The only time nginx is involved in "routing" the socket is on the initial connection. Once established, nginx is simply relaying data over an active, persistent TCP/unix sockets. For the initial connection, you can use any of nginx's normal proxy load balancing options (ip_hash, least_conn, etc).