1

I have been able to successfully set up nginx as a load balancer to proxy websocket requests (with SSL), however, really I think I need to be able to redirect them. My desired configuration is to have nginx sitting in front of a farm of websocket servers on different machines, and redirecting (not proxying) to them in round robin fashion. I don't want to proxy, because then nginx just ends up opening two concurrent connections (inbound + outbound) on the load-balancer. So even if my websocket farm can handle many concurrent connections per machine, the overall number of concurrent connections is limited by the load-balancer. I want the client to end up with a direct connection to the websocket server that does not go through nginx.

I have looked for an example of someone else doing this, and have not found much that seems very relevant. I think the directive I want to use is proxy_redirect, but, as mentioned, the documentation and other posts are thin on how to use it as described.

Am I trying to put a square peg in a round hole? What I've tried so far results in 404's. If possible, can someone recommend a setup, or where I could find more information? If this is an ambiguous/stupid/pointless question, please feel free to tell me why! I don't get my internet feelings hurt - just want to figure out how to scale my setup...

I am thinking of an alternate approach where the websocket server ip address could be served up through js. Does anyone have any experience with anything like this? Bueller...

0

It may be oversimplistic, but why not use dns load balancing? i.e. multiple ip addresses for same host, and client will automatically choice one at random.

  • That's basically the idea I am trying to achieve, but it seems that taking servers out of the pool, or directing on load factors involves additional setup or 3rd party services - still it might do. Do you know why this seems so hard in Nginx? – domoarigato Oct 22 '14 at 13:45
  • I don't think this setup involves nginx at all: you want clients to connect directly to server, skipping proxy. So, it should look like client connecting to service.example.com, dns server returns one of "A" records with low TTL (e.g. 1 min), how it choices that record is up to dns server - random, round-robin, load based. Nginx? Nginx just serving content. – Somescout Oct 22 '14 at 14:06
  • I understand that nginx isn't involved in a round robin DNS, but I am still curious if it could be used to redirect websocket straight to my back end in some sort of load-balancing arrangement. DNS load-balancing is a potential alternative, but one which has it's own different set of challenges, AFAIK. – domoarigato Oct 22 '14 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.