[MUD-Dev] New to MUD Dev, need friendly advice!
lynx at lynx.purrsia.com
lynx at lynx.purrsia.com
Sat Apr 26 10:44:27 CEST 2003
On Wed, 16 Apr 2003, Lance Rotten wrote:
> 1. Connections - What is the best method for accepting multiple
> connections? Ive heard individual threads are an awful idea, and
> that thread pools are a better idea. But I know there must be a
> much better way to do this. Say I want to have 1000 people
> connected at once ( I know this isnt likely to happen, but im
> building this to gain knowledge and experience), what would be
> the best method to handle that many connections via sockets?
A very popular MUCK has about 300-500 people connected at a time,
and runs comfortably on a Pentium-III or so. Select will handle
that.
A common design is to have an I/O thread that just reads and writes
data when data becomes available, and dispatches requests to other
threads. Then your select wakes up when you have new data to read,
or you have data that needs to be written out for sockets and the
sockets are now available to write again. Select will tell you what
sockets have events waiting on them as well.
However, if you're interested in starting an MMOG-type design where
your design scales up to 1000, 2000, etc. simultaneous users, you
might give some thought to separating your design into multiple
servers, that may run on different machines.
The very simplest design would be simply to use 'concentrators' --
that is, you have a DNS roundrobin that directs incoming connections
to one of several machines mapped to the same name, and each of
those machines has a server running on the same port. Then those
machines talk to a central server on behalf of the players who are
connected to them, and that central server arbitrates everything for
the game.
Of course a central server means a central point of failure: if that
goes down for some reason, the whole system becomes unusable. If
you want to scale your system up from there, well, this is where
software architects make their money. :)
-- Conrad
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list