[MUD-Dev] World Persistence, flat files v/s DB v/s ??

Joel Dillon emily at cornholio.new.ox.ac.uk
Sun Mar 22 13:55:22 CET 1998


> > 
> >   The problem here is that you can't do nonblocking i/o in Java. So
> > while you were waiting for input from 1 player the others would all be
> > blocked ;)
> 
> Hmm, I'm not sure that this would be a significant problem, BUT that
> depends entirely on how much information players are sending via the
> thread. If its more than a few bytes, then yes, ack, you'll be creating
> your own lag-o-rama. It might be possible to get around this by spawning
> threads from the socket-reading thread which processed and acted on the
> information, and then removed themselves (I think this may be how I was
> originally thinking).

  Well, the problem is that if you have one thread reading from all 
the sockets, and it tries to get a line (or a character, just as bad
with most modern telnets that send line-by-line) from a given socket,
it will block until it actually has a line. So if the player sits
there for 5 minutes and doesn't type a command, the socket reading
thread sits there waiting for the line and not reading from /any/ socket
for 5 minutes. This is obviously sub-optimal ;) The normal way to do
multi-user servers in Java is with threads, and for any number of users
below 1000 (at the very least) using a thread per user should be safe.

	Jo





More information about the mud-dev-archive mailing list