Quick response:

If you are using Socket.IO to communicate clients with servers, you can use
redis as a "socket.io store", so the messages that are received by
Socket.io in a server, are "broadcasted" to the other Node.js servers that
use Socket.IO

No production stressed yet, but for a similar problem, I wrote (broadcast
messages to many servers):
https://github.com/ajlopez/SimpleBroadcast

On Fri, Jul 13, 2012 at 1:43 AM, hd nguyen <[email protected]> wrote:

> Hi all,
>
> I have a concern when using pubsub mechanism of redis in my real application.
>
>
> I built a MMO game with 5 servers (NodeJs) and use pubsub of Redis to 
> broadcast game state between servers.
>
> But I concern which is the best practice to utilize this mechanism 
> efficiently with a lot of users connect and interact simultaneously?
>
> I would love to hear your ideas about following problems:
>
> 1/ Should I create NEW channel for each action or just ONE channel for ALL
> actions?
> Ex: user1 connect to server1, user2-server2,...userN-serverN
> When user1 move/fight and lost his health, those action should be
> broadcast to other servers, so each time want to broadcast I should use:
> pub1.publish("pub1", "action data sent from pub1"); //just one channel for
> ALL actions
> OR
> pub1.publish("pub1_actionID", "action data sent from pub1"); // each
> channel for EACH action
>
> 2/ And in each servers we create a client to listen:
> //subscribe ALL channels from ALL OTHER servers
>  client = redis.createClient(port, host);
> client.subscribe("pub1");
> client.subscribe("pub2");
> ....
> client.subscribe("pubN");
>
> client.on("message", function(channel, message){
>   console.log(host + ":" + channel + ": " + message);
> });
>
> As above snippet code, each server should be a client to listen ALL
> CHANNELS published by ALL other servers.
>
> But I concern whether I should use just ONE client to listen ALL channels
> or ONE client for EACH channel?
> //each subscribe for each channel
> client1 = redis.createClient(port, host);
> client2 = redis.createClient(port, host);
> client1.subscribe("pub1");
> client2.subscribe("pub2");
> ....
> client1.on("message", function(channel, message){
>   console.log(host + ":" + channel + ": " + message);
> });
> client2.on("message", function(channel, message){
>   console.log(host + ":" + channel + ": " + message);
> });
> ...
> 3/ Could you tell me how many connections redis can handle maximum in a
> second? (each time we createClient() we should create a connection to Redis
> server, right? Does it take a lot of time and overhead?)
>
> 4/ Any tool to evaluate performance of pubsub mechanism for a MMO game
> with multiple requests at the same time?
>
> Thanks for your time.
>
> --
> Nguyen Hai Duy
> Mobile : 0914 72 1900
> Yahoo: nguyenhd_lucky
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to