c++ - Distributing an application server -


i have application server. @ high level, application server has users , groups. users part of 1 or more groups, , server keeps users aware of state of groups , other users in groups. there 3 major functions:

  • updating , broadcasting meta-data relating users , groups; example, user logs in , server updates user's status , broadcasts online users in user's groups.
  • acting proxy between 2 or more users; client takes advantage of peer-to-peer transfer, in case 2 users unable directly connect each other, server act proxy between them.
  • storing data offline users; if client needs send data user isn't online, server store data period of time , send when user next comes online.

i'm trying modify application allow distributed across multiple servers, not on same local network. however, have requirement backwards compatibility old clients cannot broken; essentially, distribution needs transparent client.

the biggest problem i'm having handling case of user connected server a making update needs broadcast user on server b.

by extension, bigger problem when user on server a needs server act proxy between them , user on server b.

my initial idea try assign each user preferred server, using algorithm takes users need communicate account. reduce number of users may need communicate users on other servers.

however, minimizes how users on different servers need communicate. still have problem of achieving communication between users on different servers.

the solution come having servers connect each other, when need deal user connected different server.

for example, if i'm connected server a , need proxy user connected server b, ask server a proxy connection user. server a see other user connected server b, make 'relay' connection server b. connection forward requests server b , responses me.

the problem increase bandwidth usage, extremely high. unfortunately, don't see other solution.

are there known or better solutions problem? doesn't seem it's common distributed system have requirement of communication between users on different servers.

i don't know how flexibility have in modifying existing server. way did long time ago have servers keep tcp connection open each other. used udp broadcast told other servers each other , allowed them connect new servers , remove servers stopped sending broadcast.

then everytime user connects server server unicasts tcp message servers connected to, , servers keeps list of users , server on.

then suggest if message 1 user user on server have relay other server. servers need on same lan work well.

you can run server server communications in thread, , simulate user being on same server.

however maintaining user lists , sending messages prone race conditions (like user drops off while relaying message 1 server etc).

maintaining server code nightmare , not efficient way implement scalable servers. if have use legacy server code base not have many options.

if can using language supports remote processes , nodes erlang.

an alternative might use message queue system rabbitmq or activemq, , have servers talk each other through that. system designed scalable, , work off publish/subscribe mechanism.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -