Sign in to follow this  

How those giant online gamming servers work?

This topic is 4747 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am wondering how those giant gaming servers such as Battle.net, yahoo games, msn game zone work. Because they have hundred thousand of connections. I meant those servers can handle more than 100000 connections simultaneously,but the thing is: Isn't it the maximum sockets can be created is 65536?? Are they using multiple servers to load balance more than 100000 connections? Any tricks behind that? Sorry for my crappy english. regards, Chung

Share this post


Link to post
Share on other sites
I think you've answered your own question there.. there is no way they have one single server. Sites like these will always be a cluster of servers - for load-balancing, scalability and robustness.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Has anyone tried getting a server up to 65,535 connections? There have been servers with more than that, so how did they go higher (or did they temporarily close some sockets to do it?)? Is it a linux kernel option to only use 16 bits?

Share this post


Link to post
Share on other sites
thanks for the quick replies.
another question about battle.net :P
i have heard someone said that: except Diablo and Diablo II, other blizzard games such as warcraft3, games are hosted on client machine, the battle.net server just match the games. I mean when battle.net match player A,B,C and D together, one of them let say A will be a host and B,C and D will connect to A then start the game. During the game playing,no packet go through battle.net anymore until the game end the game host send result to battle.net again, issit true?



regards,
Chung

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I suggest you buy a copy of one of the games and play for a while - they're damn cheap these days, good fun, and you'll learn a lot :).

They have two types of game: matchmade (as you described) and "realm" (where the battle.net system provides a server).

Realm games have all data owned and policed and stored on the server by Blizzard. Cheating is hard. Cheating tends to get your accoutn deleted.

Matchmade games any moron could cheat, hack their copy, and launch a server where they utterly destroy you and steal all your items.

So...success (amongst players) in realm games is a lot more important than success in matchmade games.

There is also a flourishing community of "hacked game players" where you don't participate unless you've hacked your character to maximum hitpoitns etc. These are highly amusing: god-like maxed-out characters, fighting battles that are as evenly matched as is practically possible, it all coming down to tactics and luck (and how imaginatively you cheated your items ;)), rather than "how long you spent levelling up".

redmilamber

Share this post


Link to post
Share on other sites
I've done tests with upwards of ~10000 sockets I believe (on Windows). It's doable but generally a lousy model. One problem is that when you start getting that high you run into all sorts of annoying problems related to TIME_WAIT.

That's assuming TCP of course. But then if you're using UDP there's really no good reason to have more than a handful of ports open.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
though they probably cluster, the network performance and socket handling of a home version of windows on a pc and a unix server or win2k advanced server edition running on a smp server with a PCIX network card are worlds appart

Share this post


Link to post
Share on other sites
Well for a starters it's highly unlikely that any massive server wouldn't use a connectionless protocol. Due to certain requirements, which are fast transmission, low overhead etc. you simply cannot use a protocol like TCP. Especially if you're going to allow people that do not have a T1 at home, TCP has this nasty habit of queuing everything so everything stays in sync, a quality that makes it somewhat nice for file transfers, but horrible for games. (I say somewhat nice, because I wouldn't use it for file transfers either, it's nice to have a stream, but unless you actually <need> a stream it's a major waste of time, space, bandwith and patience)

I believe it was gamasutra that had some articles on this, you could check them out. Now if only I got around finishing my gamedev article about udp, I could be directing you there :)

Share this post


Link to post
Share on other sites
Ow and, language police:

Quote:
I am wondering how those giant gaming servers such as Battle.net, yahoo games, msn game zone work. Because they have hundred thousand of connections. I meant those servers can handle more than 100000 connections simultaneously,but the thing is: Isn't it the maximum sockets can be created is 65536?? Are they using multiple servers to load balance more than 100000 connections? Any tricks behind that?

Sorry for my crappy english.


regards,
Chung


Well, aside for a comma and a possible slight error, this is the only really troublesome thing I could find:

Isn't it the maximum sockets

to

Isn't it so that the maximum amount sockets that

So, there really was no need to apologize for any bad English, you're really doing just fine!

Share this post


Link to post
Share on other sites
Correct me if I'm wrong but the limit isn't 65535, its just the amount of RAM available to hold connection information. A TCP connection is defined by Source IP+Port AND Destination IP+Port and not just by the port # on the server machine.

Share this post


Link to post
Share on other sites
Hello All,

On Unix systems, at lest The ones I use (DEC Sun), there is a limit to the number of open file descriptor a process can have open. sockets are special file desc.
This can be change to max which is 65535.
But you get only 65535-3=65532 useful file desc that you can use.
Why -3 because there is cout, cin and cerr which you get when process runs.

Now M$ windows doesn't use file desc they use handles, basicly the same thing. But there is even a smaller max limit on most of Windwos OS, expect the Server versions which allow more.

I think on unix side this limt of 65535 file desc is so the kernel doen't need to be over large holding tables for these file desc for each process when most of the time most process won't have but a few to tens of file desc open at a time.

Lord Bart :)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Open file descriptors are a separate point. The defaults for number allowed are in the low hundreds to low thousands, unless (as you point out) you override them.

But if that were all, then you'd just launch additional processes to get another 2^16 ports each time.

I'm gonna try looking this up (dunno waht search terms to use htough without getting lots of crap) because I have a feeling that linux now has a higher number (2^32 perhaps?) addressable.

That's the real question: how many can the OS address? Once you know that, it's simply an implementation issue of your program how many you can usefully use.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I believe that IPv4 only allows a 16bit number for allocating a name to a bound socket, no?

In which case, linux can only go over 2^16 ports if running something else (maybe IPv6 has a more sensible upper limit? 2^16 isn't much headroom for the next 30 years...)

Share this post


Link to post
Share on other sites
Hello All,

I look around, and found a few site about limits in open file desc.
http://httpd.apache.org/docs/misc/descriptors.html
http://bbcr.uwaterloo.ca/~brecht/servers/openfiles.html

I would think that if there is a limit to number of open file desc per process.
You could have a controling process parent that start a child process then it is told by the child that it at max open files.
The child would stop accept new connections, the parent would start a new child process that can accept new conntions. While the first frees up connections and when 2nd child full up and when full tell the parent which could tell first to child start accepting agian.

It would be a little complex but doable.

Lord Bart :)

Share this post


Link to post
Share on other sites

This topic is 4747 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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