Load balancing SockJS server backends - sticky and least connections simultaniously

236 views
Skip to first unread message

Александр Емелин

unread,
Oct 17, 2014, 5:33:44 PM10/17/14
to soc...@googlegroups.com
Greetings everyone!

Please - look at this issue https://github.com/FZambia/centrifuge/issues/47

There are several SockJS server backends and Nginx as load balancer. To route each client request to the same backend sticky sessions used.

So upstream looks something like this:

upstream app {
    sticky;
    server 1;
}

Clients connect to server 1 and then there is a moment when another server backend must be added:

upstream app { sticky; server 1; server 2; }

But new clients round-robin to both servers - so the load on server 1 continues to grow.

What we want here is least connections algorithm when sticky cookie is not set - so our both servers get approximately equal load. As far as I know this is not possible with Nginx.

So several questions here. Am I right? Or maybe I missing something and load balancer can be configured in another way which solves problem with unequal load. I saw examples of Haproxy config file (https://github.com/sockjs/sockjs-node/blob/master/examples/haproxy.cfg) which does load balancing by sockjs URL - how it behaves in situation described above?


Bryce Kahle

unread,
Oct 20, 2014, 1:44:33 PM10/20/14
to frv...@gmail.com, soc...@googlegroups.com
This is a question for nginx or haproxy and is not specific to SockJS.


Bryce


--
You received this message because you are subscribed to the Google Groups "sockjs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sockjs+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Александр Емелин

unread,
Oct 21, 2014, 2:43:02 AM10/21/14
to soc...@googlegroups.com, frv...@gmail.com
Yep, I realize that this is not a direct SockJS question - I was just looking for help with SockJS real-world usage from people already deployed large SockJS applications.
Reply all
Reply to author
Forward
0 new messages