[MUD-Dev] Disk v. Mem

Dan Root dar at thekeep.org
Tue May 13 11:29:06 CEST 1997


"ashen" <ashen at pixi.com> writes:


> let me stab in the dark:
> do you really need to save that much memory? 
> do you need it for something else? 

In a lot of cases your server is not the only one on the machine.  And
even it is, that machine may not be a dedicated mud machine.  The
server I'm developing runs on a machine that provides services to over
40 users, and has 4 to 10 people logged on all the time  (In addition,
it's the primary smtp, imap, afs, nfs, dns, time, and kerberos server
for this group of people).   Yeah, I need the memory.  :)


> are objects so large that 40,000 of them fill mem quickly?

I'm implementing a design that stresses simplicty of the server, and
despite this, every object has a minimum of 40 bytes of overhead, even
empty.  That's 1.6Megs of data just for the overhead of tracking and
storing 40,000 empty objects.  Add (for sake of arguement) 1k of text
and code to each object, and you're now talking 40 megs of data, just
to hold it in memory.  (and most of my objects are going to be a lot
bigger than 1k).  

> does too full a mem size inhibit the driver speed?
> isn't it more costly in speed to write to disk? 

If you don't have physical memory to back it up, then you're going to
swap files anyway, in which case you now have the overhead of reading
all the objects in from disk, parsing them into memory, and then
writing them back out to the swap file so your OS has enough room to
be useful.


While it's true that on a reasonable OS a swap file is faster than
regular disk access, that's an awful lot of overhead to be dealing
with.

> what kind of savings do you get versus this extra cost?

In general, you probably aren't using all 40,000 objects at one time.
Even if you have 30 people on line, you're probably only dealing with
a set of a couple of thousand objects at any one time.  You save the
overhead of not loading all the random things that are in areas that
aren't visited or not used.  It also means that your database is
updated fairly often, meaning less loss during a crash, and less time
stolen from the players to dump a gazillion megs of data out to disk.


	-DaR
--
Dan Root - dar at thekeep.org



More information about the mud-dev-archive mailing list