Sign in to follow this  
39ster

Using multiple servers

Recommended Posts

In a big online game you would use multiple servers for one world (each server hosts its own levels/zones). Im guessing there is a main server. When a player enters a zone, should they connect directly to a child server, or send everything to the main server which acts as a proxy and forwards it to the correct child server hosting that zone? Is it quicker to connect to a server if you're already connected on another port on the same network? Is there a limit on how much people can be connected to one network? (maybe 65536 seeing as ports are represented by 2 bytes)

Share this post


Link to post
Share on other sites
I'd say connect to the zone server. The login server should know where the players are connected, but yeah it should be abstracted. Also if it matters to your design you might want to allow zone servers to crash and not effect the total cluster. This would include the login server. So something like a database would be used by the login server to quickly manage the cluster data and in case of a crash it will recover quickly. Like the server IPs of the zone servers and such so it doesn't miss a beat per say.

I'd worry about the number of max connections later. Exceeding 65,000 connections is the least of your problems.

[Edited by - Sirisian on May 7, 2008 9:56:34 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by 39ster
In a big online game you would use multiple servers for one world (each server hosts its own levels/zones). Im guessing there is a main server. When a player enters a zone, should they connect directly to a child server,
That's one way to do it.
Quote:
or send everything to the main server which acts as a proxy and forwards it to the correct child server hosting that zone?
That's another way to do it.
Quote:
Is it quicker to connect to a server if you're already connected on another port on the same network?

Sockets aren't aware of each other, so no. Unless you use some complex protocol, and establishing new connection can bypass some handshake.

An example of this is using tokens. When player logs in, server performs database lookup to test for account and password, permissions, etc. After that, it hands client a temporary token (a semi-random number). From then on, client authenticates with this token, thereby not requiring any kind of authentication.

Quote:
Is there a limit on how much people can be connected to one network? (maybe 65536 seeing as ports are represented by 2 bytes)


There are some physical limits, but you'll reach practical limits with thousands of users. Actual limits you'll be dealing with involve bandwidth, CPU or memory.

Share this post


Link to post
Share on other sites

1) Auth (Login Server)

2) Network servers (connection management, also are called proxy)

3) Zone servers (zone processing, have pipes to network server and neighborhood zones servers)

4) Database server






Share this post


Link to post
Share on other sites
I think 3 separate servers is overkill for the login server, "network server", and database. The login server is a good choice for deciding who manages the zone servers. Managing 2 applications is much easier also (login server and zone cluster app). The login server is rarely under pressure and doesn't need it's own server. I'm not 100% sure what you mean by "Network Server" but if you mean things like zone balancing the login server can handle it. It already needs to route players to servers and must know the status of servers. Having it manage the database and the zone servers makes sense at this point since it's already acting like the focal point for data storage. Also if it becomes a problem, the database can be moved out of the login server to a separate server.

(Put it this way my university servers I manage constantly communicate with the main server and all printing and login data is queried through it along with tons of other stuff and it doesn't break a sweat. (low CPU usage overall).)

Share this post


Link to post
Share on other sites
Quote:
Original post by Sirisian
I think 3 separate servers is overkill for the login server, "network server", and database.
It all depends, you may as well need 25 or 30 "front end" servers, 5 or 6 zone servers, and 3 or 4 dedicated database servers. With enough players, even a dedicated login server can get busy.

From the question about running out of ports, I guess that the OP aims at 10s to 100s of thousands of simultaneous players, rather than 20 or 30. This is not something you do with 2 machines, especially if it has to be somewhat failsafe, too.

100k simultaneous players is an awful lot, and the OP is not likely to have anything the like in the near future (if he ever does, he is a very rich and happy man), but let's just assume for a minute.
Imagine 100k players as average load, and assume that everybody plays 3 hours per day on the average. Assuming that nobody ever gets disconnected, that's 800,000 logins per day. A day has 86400 seconds, so we're talking of roughly 10 logins per second. Considering that every login requires at least one database query and setting up some cryptographic stuff, that's not trivial, even for a dedicated machine.

Share this post


Link to post
Share on other sites
Quote:
Original post by samoth
Imagine 100k players as average load, and assume that everybody plays 3 hours per day on the average. Assuming that nobody ever gets disconnected, that's 800,000 logins per day. A day has 86400 seconds, so we're talking of roughly 10 logins per second. Considering that every login requires at least one database query and setting up some cryptographic stuff, that's not trivial, even for a dedicated machine.


10 requests per second isn't much. Typically, each player will submit a position update that often.

You might need to cache the accounts database locally on the server, or even use memory database, if SQL becomes bottle-neck.

During peak you might need to handle hundreds of requests per second, but since login is not time-sensitive, that again is not that much of a problem. I'm pretty certain that a mid-level server should be capable of handling such load.

Share this post


Link to post
Share on other sites
A single port on a server can serve as many distinct clients you can think of. The only limitation is that a given client host can only have 65,535 connections to the same server host+port before running out of distinct client-side port numbers in TCP.
As others said, you'll run out of other things well before that time.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sirisian
I think 3 separate servers is overkill for the login server, "network server", and database. The login server is a good choice for deciding who manages the zone servers. Managing 2 applications is much easier also (login server and zone cluster app).


Network server can manage zone or no. Network server can be named as "Connection Server".
When client has connected to AuthServer, AuthServer sends address of Connection server (less loaded server of all) and after client connect to assigned "Connection server".

"Connection server" - resends: broadcast message, zone-broadcast message, "InRange" message to players connected to such server. It reduce loads of games server for make decision which players must be receive message.


Game server is a Game server :)

Database need for store players data and helps to write tools summarize, obtain, create reports usefully information from game.




Share this post


Link to post
Share on other sites
Quote:
Original post by Ramsess
Quote:
Original post by Sirisian
I think 3 separate servers is overkill for the login server, "network server", and database. The login server is a good choice for deciding who manages the zone servers. Managing 2 applications is much easier also (login server and zone cluster app).


Network server can manage zone or no. Network server can be named as "Connection Server".
When client has connected to AuthServer, AuthServer sends address of Connection server (less loaded server of all) and after client connect to assigned "Connection server".

"Connection server" - resends: broadcast message, zone-broadcast message, "InRange" message to players connected to such server. It reduce loads of games server for make decision which players must be receive message.


Game server is a Game server :)

Database need for store players data and helps to write tools summarize, obtain, create reports usefully information from game.




Some of the models also have a seperate set of 'AI servers' which run the NPCs in the zones (which can be handy to implement NPCs that chase you across zone boundries...) The NPCs act something like they were player clients objects issuing the same movement commands and interactions (and keeping their own local world representation).

'Real' AI can consume ALOT of CPU so it takes adding more computers (seperate from the Zone servers) to handle the load.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this