I am making a chat-application. To scale and use all cores, i
am creating multiple servers which are listening on same port given by
infrastructure for listening. Every information is in memory.
However, is it possible that lets say.. A and B are chatting each other and have information in process1 and X and Y are chatting and have information in process2.
My question is :
A, Can it go to process2 which have no information about A or B. Or does it depend upon something like if i use simple http messages above problem would happen but if i use web-sockets it would not happen.
I am using node.js, though i consider it to be a language independent problem.
so, code is like :
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
} else {
http.Server(function(req, res) { ... }).listen(8000);
}
Should i make only one listening-process which would act like intelligent load-balancer that would send the message to right process ?