Few question about pomelo #88

Open
numbcoder opened this Issue Feb 4, 2013 · 4 comments

Projects

None yet

3 participants

@numbcoder

I have few question about pomelo.
Do you use redis for session strorage?
can I dynamiclly add/remove servers/process without losing data such as channels/areas/schedual and session?
How do you use rpc? lets say that a client connect to connector1 and he want to send message to client 2, both users belong to area 1 on game server 1,
and there are 5 game servers, does the connector keep trak on the areas info, so it wont have to send each message to all 5 game servers?

@xiecc
Member
xiecc commented Feb 4, 2013

A lot of questions, let be reply it one by one.
Currently, we are using memory based session storage, which makes pomelo light weight. And we do not find any reason to implement it in redis, since there is no session replication or other scalability issues in game server.
However, pomelo is flexible enough for you to plug in a redis implementation of session, since session is just a component of pomelo.

@xiecc
Member
xiecc commented Feb 4, 2013

can I dynamiclly add/remove servers/process without losing data such as channels/areas/schedual and session?

In 0.3 version, your can dynamically add servers/process.
Pomelo do not provide mechanisms to save channels/areas data, so remove process may lose data.
Of course you can implement saving strategy yourself.

@xiecc
Member
xiecc commented Feb 4, 2013

How do you use rpc?

I do not quite understand your question.
Since they belong to same area, there should be not rpc happen, since both players are in same process.

But if you are talking about connector to area rpc, what we are doing is using session as the first parameter, and using route method to find the player area.

For example, the following is a connector to area call:

app.rpc.area.playerRemote.playerLeave(session, {playerId: session.get('playerId'), areaId: session.get('areaId')}, function(err){
        if(!!err){
            logger.error('user leave error! %j', error);
        }
    });

The first parameter session can tell you exactly which area the player is, and the framework will route to the target area server based on areaId. The route method is as follows:

exp.area = function(session, msg, app, cb) {
    var areas = app.get('areaIdMap');
    var serverId = areas[session.get('areaId')];
        cb(null, serverId);
};

It find target serverId based on areaId.

@lzw216
lzw216 commented Feb 5, 2013

Your problem make me confused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment