[MUD-Dev] Questions about server design

&lt &lt
Tue May 7 14:23:28 New Zealand Standard Time 2002

From: "Ben Chambers" <bjchamb at bellsouth.net>

> First question, is about the new java.nio classes introduced in
> version 1.4.  I've seen a lot of information using them as simple
> echo servers, but not much on expanding that to something like a
> chat server or beyond.  What would be the best way of handling
> this?

Probably the same was as with an echo server....but echo it to
multiple nodes.

> It seems from what i've read that you can't write until you're
> done reading.  This would suggest some form of queue, but it would
> get costly to have that many messages in a queue for each person.
> I was thinking of some form of global queue, where each person has
> his or her point in that, and every time you'd write it would
> advance your spot, but that runs into some problems as well.  How
> would you implement a non-blocking, possibly multithreaded in
> order to improve response time, server?  If you did multi-thread
> it, how do you handle communication between the threads?  What
> system do you use to divide the incoming connections?

Are we talking about n-tier servers, or just a single server?  If
it's just a single server, you can get really good performance out
of a single thread.  No context switches, and since it's just a chat
app you're not really worried about "async" calls, but more
serialized pulls from queues.

> Second question, how plausible is XML as a format for MUD data
> files as opposed to a SQL based database?  Would it be fast enough
> using the java classes to parse it to create a XML based format
> for my MUD data files instead of using SQL?  This idea appeals to
> me because it makes it easier to write object oriented data files
> that take into account inheritance and stuff, but I don't know if
> the load times would be drastically reduced.

Again, it depends on your target.  XML w/java WILL be slower than
java/SQL, moreso as the database grows.  However, XML databases are
easier to work with than trying to put an object map on top of an
RDBMS. *shrug* Possible?  Yes.  But only you can determine the
tradeoff (speed/performance for ease of coding.)  If you load the
entire world into memory, XML will probably work okay for infrequent
updates.  For heavy load, either an object database or an RDBMS is
probably a better choice, IMHO.


MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list