Advertisement

which I/O model for game server?

Started by September 17, 2005 12:19 PM
2 comments, last by Fistandantilus 19 years, 5 months ago
hi there, i would like to ask which I/O Model is suitable for a game server in UNIX? for 1. MMORPG? 2. provides a lots of game lobby rooms? any suggestions are highly appreciated. thanks!! pixelmana
You should probably start with the simplest possible one, and only change if there is a good reason to do so.

Obviously it will depend whether you're using tcp and/or udp, I'll assume you're using TCP or both for this discussion.

The simplest possible IO model is to use a single thread select() loop. This has proven to work well at most (small / medium) scales, and is what most servers of (non-massively) multiplayer games use.

Therefore I suggest that you start there, and once you've got a working client and server, and find that scalability is a problem (too much time spent in select and configuring your FD_SETs), look for an alternative.

Oh yes... one other thing: it's also simplest to do all local IO (disc files etc) synchronously. This is great, especially if you have enough memory to load absolutely everything in at once.

Mark
Advertisement
A more complete (but somewhat complicated for beginners) discussion about network I/O strategies for the type of project you are envisionning using a Unix system can be found here:

http://www.kegel.com/c10k.html (Clicky)

-cb
For Unix you should take a look at kqueue, it´s more efficient than select and poll. There´s also the poll device /dev/poll. There´s information about both in the new Unix Network Programming from Stevens.

If you choose to go Windows, use IO Completion Ports.

This topic is closed to new replies.

Advertisement