Re:Open Source Chat Server in Node.js with dynamic rooms
by mcantelon on Monday May 28, 2012 @02:38AM
(#4032239)
Be sure to use Node's cluster API (http://nodejs.org/docs/v0.6.0/api/cluster.html) so each core on your server gets utilized. Doesn't look like this, looking at the source, is doing that so unless they're manually running an app instance on each core and load balancing between them then they may be underutilizing their hardware.
Beyond that: using Nginx to serve any static assets (http://stackoverflow.com/questions/5009324/node-js-nginx-and...) and standard stuff like making sure everything's cached that should be, load balancing, etc.
Re:Open Source Chat Server in Node.js with dynamic rooms
by ladon86 on Monday May 28, 2012 @04:08AM
(#4032432)
At ClassDojo we support many thousands of concurrent users on node.js using cluster to create multiple worker processes and using multiple boxes with Amazon ELB in front of them. All static assets are served from the CDN.
Handling your state in memory is fine for examples such as this, but in general you should defer all state to the database layer or use something like redis. That way your app server will remain entirely stateless so any node.js process on any box can serve a request identically - you can just scale up by adding additional boxes.
Re:Open Source Chat Server in Node.js with dynamic rooms
by heroic on Monday May 28, 2012 @07:05AM
(#4032846)
A very fine way is to have multiple processes and connect to any at random. Now, use a message queue, say like redis, or rabbit mq to read messages and delete from queue. Since a client is only connected to only one of the servers, it eliminates the chances of sending the same message more than once to the same client. This helps in splitting the incoming messages and the outgoing(which is usually far bigger, since one message is delivered to all others in a chat room).
Any tips or explanations would be most welcome.