   Load balancing server
  Hi all, I've just made my first demo of online game. It consists of one server app and one client app. Now I'd like to try a load balancing server...from my understanding..load balancing server is some collection of servers that communicate each other and try to balance network load by "sharing" clients(moving the client from the heavyly loaded server to a light-burdened server). Please correct me if I'm wrong. My question is how to make those servers "talk" to each other. If it's UDP it might be a bit simpler to do. But I'm doing networking things using TCP...so if anyone can point me to a good link or site I would appreciate that...Please forgive me If I post in the wrong place. Sorry for my bad english...Please answer me if you have time..Id like to learn from you guys...I know there're many experts in gamedev.net. Best Regards, Triad Prague   
  I am not an expert in load balancing, but I know a bit about this.I would start by reading thishttp://en.wikipedia.org/wiki/Load_balancing_(computing)Now about implementation, I would do something like thishttp://www.tutorialspoint.com/images/tomcat-load-balance.gif(dont pay attention on names, its just a picture I found).So as I understand the only this the middle server (names apache web server on the pic) needs to know is how loaded the nodes and if the node is down.So a periodic UDP update from the node to the center server will be enough.Define periodic update as every 30 second and down-time-timer 90 second (just examples, I believe the number will change based on your traffic and the structure of the server cluster), so every 30 second node send a udp message like "im alive, got 500mb free and 45% cpu usage and other statistic you would like to know", while the center server manages a timer for each node in the cluster and if after 90 second there were no update node considered as down.Other approach is that the center server will initiate the periodic update and every 30 (again arbitrary number) second will query nodes status.When new connection arrives the center server will redirect it to the less loaded cluster based on last statistic (or any other algorithm the fits)Hope it was at least some help :)   ;  Load balancing in games is almost always based on the game mechanics. For poker games, each game table can run on a different host. For area-based games, each game area can run on a different host.The reason for this is that online games are about real-time interaction between players, not just an array of parallel single requests like, say, a web server."Moving" load between servers is generally a bad idea, because the reason a player is handled by a specific server is because it's interacting with other players also on that server. The limitation on scalability is the size of the largest single interaction possible -- the largest possible poker table, the largest possible player gathering in a zone, etc. If interacting players are on different servers, overall system load goes up dramatically, without actually adding any real scalability.So, load balancing for games generally ends up being a central "director" that figures out where players want to interact (what poker table to play at, what game area to play in, etc), and tells the game client where to connect to for that interaction. The client then connects directly to the appropriate host.;  So you say that load balancing is bad for Online games, well Ok, I'll use single server topology then. Thx for the replies, I'd continue making the game and not worry about load balancing then.   ;  Its not bad. It just depends on the mechanics of the games as hplus0603 said.For example many MMOs (if not all of them) uses at least two server: the login server and the game server. It also can be considered as load balancing specially if the game bandwidth if huge and each server occupies a different psychical machine.   ;  A technique often used for load balancing MMORPG servers involves having a proxy server that handles all direct interaction with the game client. The world is then subdivided into geographical segments (often called cells, chunks, areas, etc) and spread out over several host machines. If the proxy server can map players to cells, it is able to relay messages from the client to the appropriate server instance for handling. For example, let's build a fictional server system that consists of an authentication server, a proxy server and one or more cell servers. The client first communicates with the authentication server, which issues a ticket. The ticket is then used when connecting to the proxy server. The proxy server validates the ticket and loads the data needed (player position, perhaps?), requests the cell handling that position to create a player entity, and then starts relaying client messages to that cell. If the client should ever come close to a cell boundary (edges where two cells managed by different hosts meet) the authoritative cell (the cell responsible for the player) starts sending information about the player to the adjacent cell in a process known as ghosting. This allows the adjacent cell to inform all players that it is responsible for of the player in the original cell.If the player entity crosses a cell boundary, it is migrated to the cell which it entered. This is done in a way similar to ghosting (indeed, all the necessary information may already be present on the receiving cell server). Lastly, the proxy server is informed so that it can remap the player to the new cell.If you want a more in-depth overview of MMO load balancing architectures I recommend you read Massively Multiplayer Game Development (ed. Thor Alexander).This paper might also be useful.   