[MUD-Dev] How to support 1000+ simultaneous connections, and some philosophy.
greear at cyberhighway.net
Thu Mar 11 18:29:35 New Zealand Daylight Time 1999
Petri Virkkula wrote:
> >>>>> "Chris" == Chris Gray <cg at ami-cg.GraySage.Edmonton.AB.CA> writes:
> Chris> The problem with that is that then the clients have to connect to one
> Chris> of those 10 ports. You might manage that if you have a special client
> As others have pointed out there would not be multiple ports,
> but multiple addresses with a single port number. The
> addresses would then be given out eg. in round-robin
> order. This is how many www-sites balances load between
> multiple machines (my suggestion would distribute the load
> between multiple processes, not machines).
> If my first idea cannot be used (eg. because of limited amount
> of ip-addresses), here is another idea:
> Make the connection server accept eg. 1000 connections (and
> serve them all). After that the server can fork(). The new
> child would then close the main socket that is being listened
> and only serve its 1000 clients. As soon as all the 1000
> clients have closed their connections just exit the child. At
> the same time the parent process closes all the client sockets
> and start again collect a new set of 1000 clients.
You overlook a detail. You have to recompile or otherwise tweak your OS
to get 1000 clients. However, your plan is still valid for the real max
of somewhere below 256 (in most cases.)
However, I plan on letting one get full, and then check for other more
ones. If I can find one, then the main server will close the accepting
and send a (proprietary) message to the more empty one. Then the more
one (re)opens the listening port. Sounds pretty easy to implement,
divorced from low level OS stuff, and efficient.
> The above method might result in multiple processes, each of them
> handling just few clients. But the system might work fairly
> well, but that is difficult to say without testing.
> MUD-Dev maillist - MUD-Dev at kanga.nu
Ben Greear (greear at cyberhighway.net) http://www.primenet.com/~greear
Author of ScryMUD: mud.primenet.com 4444 (Released under GPL)
MUD-Dev maillist - MUD-Dev at kanga.nu
More information about the MUD-Dev