{"action":"created","issue":{"url":"https://api.github.com/repos/socketio/socket.io-redis/issues/207","repository_url":"https://api.github.com/repos/socketio/socket.io-redis","labels_url":"https://api.github.com/repos/socketio/socket.io-redis/issues/207/labels{/name}","comments_url":"https://api.github.com/repos/socketio/socket.io-redis/issues/207/comments","events_url":"https://api.github.com/repos/socketio/socket.io-redis/issues/207/events","html_url":"https://github.com/socketio/socket.io-redis/issues/207","id":217587567,"number":207,"title":"Does socket.io-redis still suffer the problems mentioned in the linked article?","user":{"login":"ismail-khan","id":8074712,"avatar_url":"https://avatars1.githubusercontent.com/u/8074712?v=3","gravatar_id":"","url":"https://api.github.com/users/ismail-khan","html_url":"https://github.com/ismail-khan","followers_url":"https://api.github.com/users/ismail-khan/followers","following_url":"https://api.github.com/users/ismail-khan/following{/other_user}","gists_url":"https://api.github.com/users/ismail-khan/gists{/gist_id}","starred_url":"https://api.github.com/users/ismail-khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismail-khan/subscriptions","organizations_url":"https://api.github.com/users/ismail-khan/orgs","repos_url":"https://api.github.com/users/ismail-khan/repos","events_url":"https://api.github.com/users/ismail-khan/events{/privacy}","received_events_url":"https://api.github.com/users/ismail-khan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-03-28T14:53:11Z","updated_at":"2017-03-29T22:26:20Z","closed_at":null,"body":"I just read this somewhat old article: [Cluster f***s when scaling Socket.IO](https://medium.com/@3rdeden/cluster-fucks-when-scaling-socket-io-2c8ad1153332)\r\n\r\nHere are the parts that worry me:\r\n\r\n1. Apparently socket.io-redis saves connection data in each node separately, and not in Redis:\r\n\r\n> All this data will be synced through pub/sub to every connected Socket.IO server. So if you have 2 node process and they both use Socket.IO stores they will both have all the data of all connections in their own process memory.\r\n\r\n\r\n2. It's not so simple to add a node, since we need to bring all processes/server online at the same time (I'm on Heroku and would like to scale up/down regularly/flexibly, so this is worrying!):\r\n\r\n> But storing data isn’t the only problem. Usually when you want to scale out you just want to be able to add new servers without taking your whole cluster down. This is impossible with Socket.IO. When you add a new server you need take your whole cluster down because the synced data is not stored in a general location. It’s only stored in the process’s heap, and when you join the cluster it doesn’t ask the other node processes for the old data so it’s a completely blank and empty server and can therefor not accept them and will close the connection with a “unknown handshake” error. The only way to combat this is to take your whole cluster down. Add new node processes/servers, bring them all online at the same time and start accepting connections again. \r\n\r\n\r\n3. Every connection creates 5 different channels!\r\n\r\n> For every connection that is established the store will subscribe to 5 different channels. So if you have 10000 concurrent connections you will also have 50000 subscriptions to your redis server which causes redis to use a magnitude more CPU than if it would just use single or a couple of channels to communicate over for ever connection.\r\n\r\n\r\nIf this has been solved, then I'd like to use socket.io-redis + socket.io-emitter to horizontally scale my app. If not, then I'll just have to implement a custom solution on top of redis.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/socketio/socket.io-redis/issues/comments/290245360","html_url":"https://github.com/socketio/socket.io-redis/issues/207#issuecomment-290245360","issue_url":"https://api.github.com/repos/socketio/socket.io-redis/issues/207","id":290245360,"user":{"login":"darrachequesne","id":13031701,"avatar_url":"https://avatars0.githubusercontent.com/u/13031701?v=3","gravatar_id":"","url":"https://api.github.com/users/darrachequesne","html_url":"https://github.com/darrachequesne","followers_url":"https://api.github.com/users/darrachequesne/followers","following_url":"https://api.github.com/users/darrachequesne/following{/other_user}","gists_url":"https://api.github.com/users/darrachequesne/gists{/gist_id}","starred_url":"https://api.github.com/users/darrachequesne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrachequesne/subscriptions","organizations_url":"https://api.github.com/users/darrachequesne/orgs","repos_url":"https://api.github.com/users/darrachequesne/repos","events_url":"https://api.github.com/users/darrachequesne/events{/privacy}","received_events_url":"https://api.github.com/users/darrachequesne/received_events","type":"User","site_admin":false},"created_at":"2017-03-29T22:26:20Z","updated_at":"2017-03-29T22:26:20Z","body":"Well, that's an interesting idea. If I understand correctly:\r\n\r\n```js\r\nkey _all => server1, server2 // keep track of each server (to broadcast)\r\n// a new socket connects\r\nkey socketid1 => server1\r\nkey socketid2 => server2\r\n// socket1.join('room1')\r\nkey room1 => server1\r\n// socket2.join('room1')\r\nkey room1 => server1, server2\r\n```\r\n\r\nHow do you handle key removal (in case a server gets disconnected)?"}}
{"actor":{"display_login":"darrachequesne"}}