Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How to implement node.js to be able to handle 250k connections as comet server (client side we use socket.io)?

Would the use of nginx as proxy/loadbalancer be the right solution? Or will HA-Proxy be the better way? Has anyone real world experience with 100k+ connections and can share his setup? Would a setup like this be the right one (Quad core CPU per server -> start 4 Instances of node.js per Server?):

  nginx (as proxy / load balancing server)
        /               |          \
       /                |           \
      /                 |            \
     /                  |             \
node server #1  node server #2  node server #3
4 instances     4 instances     4 instances
share|improve this question
    
YouPorn runs with nginx as load balancer so I'm pretty confident it can handle your load :P –  Antoine Benkemoun Nov 29 '11 at 17:45
    
@AntoineBenkemoun "Handle your load" may have been an unfortunate choice of words there. –  ceejayoz Nov 29 '11 at 18:08
    
@AntoineBenkemoun Our requirement of 250K tcp connections is another playarea and far away from a few hundred http req/sec that a site like YP makes. –  Nenad Nov 29 '11 at 21:02
add comment

1 Answer

vanilla nginx doesn't support HTTP/1.1 keepalive to the upstream (backend) servers, which breaks socket.io :( If you're willing to compile it yourself, you may have better luck --> http://www.letseehere.com/reverse-proxy-web-sockets

Though at that scale I wonder if it would be smoother to skip the web server layer, routing the TCP connections directly...

share|improve this answer
    
Thank you for the Link. I need to check if HA-Proxy is able to make a proper TCP routing. Would like to hear if anyone has some Real World experience. –  Nenad Nov 29 '11 at 21:04
    
since 1.1.4 nginx has ngx_http_upstream_keepalive module and proxy_http_version directive –  SaveTheRbtz Nov 30 '11 at 11:09
    
@SaveTheRbtz great news, I hope they release soon a stable version that include the proxy_http_version directive. –  Nenad Dec 1 '11 at 4:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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