7 ms·
Took a look at your code and noticed you're using Socket.io. Don't use Socket.io for anything over double digit concurrent users. It's well known to be horrible
by Oculus 13y ago
Took a look at your code and noticed you're using Socket.io. Don't use Socket.io for anything over double digit concurrent users. It's well known to be horrible at scaling. If you want something that's better at scaling I'd suggest SockJS[1].
1 - https://github.com/sockjs/sockjs-node https://github.com/sockjs/sockjs-node
- granttimmerman 13y agoI'll look into it. Thanks
- alecsmart1 13y agoYour app's down :(
- deleted 13y ago[deleted]
- bib971 13y agoAnything to backup your claim about Socket.io?
- DigitalSea 13y agoThis is a rather inaccurate statement to make. I've used Socket.io with double digit concurrent users before and Socket.io handled things fine.
- derefr 13y agoYou're not disagreeing with the parent. They said more than double-digit.
- ahdinosaur 13y agoi'd suggest https://github.com/primus/primus https://github.com/primus/primus. it's an abstraction layer for real-time so no lock-in to a single socket implementation. it's simple and extensible by plugins.
- gargarplex 13y agoSeconded. I ran a very popular website that used Socket.IO. It broke down whenever we had 200+ concurrent users. Sockets would randomly close.
- babuskov 13y agoThe "over double digit" claim is simply not true. I'm running three multiplayer games for about two years now, and it starts to have problems once if goes over 3500 concurrent connections. It could be that I just hit the right combination of node+socketio versions, though, as I had problems with newer ones. My setup is: node.js 0.6 socket.io 0.9.6 This version of socket.io has a nasty bug in jsonp protocol handling which I patched manually by merging some change from a newer version, but it does work fine. To make it scale, I run multiple node processes. In the last 300+ days each of those has between 1000 and 2000 concurrent connections all the time and it works fine. Except that there is some memory leak (I'm not sure if it's related to socket.io or some other lib), so I restart each server once a week (it's done automatically each Sunday at 2am). I had my eye on SockJS since 2012, and it looks like newer versions are really good, but I'd need upgrade to newer nodejs and this is simply not possible for the existing projects as many used modules are not available. However, if you're starting a new project, it's worth testing and see which performs better.
- feronull 13y agoWe also do had a memory leak because of socket.io 0.9.6 take a look at this discussion https://github.com/LearnBoost/socket.io/issues/1303#issuecomment-33107520 https://github.com/LearnBoost/socket.io/issues/1303#issuecom...
- babuskov 13y agoInteresting, but I'm not using Redis nor MemoryStore. I gave each machine behind HAProxy a different hostname (mapped to the same IP address), and I route the clients in roundrobin fashion to each of those before they open the page with socket.io javascript. It works like this: - client opens a page on HAProxy load-balancer picked server - the actual node server that receives the request, redirects the browser to its custom hostname using the same URI - client opens the same page on the particular server and socket.io connects to that subdomain This ensures that all future requests (if socket.io connection is broken) will go to the same server without Redis, MemoryStore, cookies or whatever. Drawbacks: - one additional HTTP redirect when page that contains socket.io is loaded (luckly, in games there aren't many of those) - if you want to retire some sub-domain hostname, you have to be careful to allow existing clients to re-connect somewhere else. Not really a problem for my setup, but YMMV.
- ttty 13y ago"Under the hood SockJS tries to use native WebSockets first. If that fails it can use a variety of browser-specific transport protocols and presents them through WebSocket-like abstractions." - SockJS How this is helping? "Flash is absolutely not required for Socket.IO to function. If Flash is available, it'll be leveraged, as it provides almost the same capabilities as WebSocket. If it's not, the next best transport will be chosen." - Socket.io
- Oculus 13y agoMy understanding is the issue is not in the protocols, but in the implementation of the libraries themselves.