node.js - Route traffic to multiple node servers based on a condition -


i'm coding online multiplayer game using nodejs , html5 , i'm @ point have multiple maps people play on, i'm having scaling issue. server i'm running on isn't able support game loops more few maps on own, , though has 4 cores can utilize 1 single node process.

i'd able scale not limited single server. i'd able start node process each map in game, have master process looks map player in , passes connection correct sub process handling, updating game information, etc.

i've found few ways use proxy nginx or built in node clusters load balance can tell examples i've seen give connection whatever next available process is, , need hand them out specifically. there way me route connection node process based on condition that? i'm using express serve static content , socket.io client server communication currently. information map player in in mongodb along rest of player data, if makes difference.

there many ways adress problem, here 2 suggestions based on description.

1 - use router server dispatch players queries "area servers" : in topology clients queries arrive route server, server tag each query unique id , dispatch right area server, area server handle query , sendit route server recognize unique tag , send response client.

this solution dispatch cpu/memory load not bandwidth !

2 - use authentication server redirect client servers less load : in case, you'll have multiple identical servers , 1 authentication server, when client authenticate, send url , auth token of available server client , authentication ticket server. client connect server recognize using auth toekn/auth ticket.

this solution dispatch cpu/memory/bandwidth, might not suited games since can sent different server each connection , you'll not see players in same area if not on same server.

those 2 simple suggestions, can mix 2 approaches or add other stuff (for example inter-communication area servers etc) solve mensioned issues add complexity.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -