1998Q1/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev]  World Persistence, flat files v/s DB v/s ?? -->
<!--X-From-R13: Aevba Vrael <bevbaLNvk.argpbz.pbz> -->
<!--X-Date: Tue, 31 Mar 1998 02:42:04 +0000 -->
<!--X-Message-Id: 3.0.5.32.19980331113937.007c5360#popd,ix.netcom.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199803250720.AAA25248#user2,inficad.com -->
<!--X-Reference: Pine.LNX.3.96.980325215121.400A&#45;100000#shamen,cyberhighway.net -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:orionZ#ix,netcom.com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00916.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00918.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00901.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00918.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00917">Author</A>
&nbsp;|&nbsp;<A HREF="#00917">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00917">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</LI>
<LI><em>From</em>: Orion Henry &lt;<A HREF="mailto:orionZ#ix,netcom.com">orionZ#ix,netcom.com</A>&gt;</LI>
<LI><em>Date</em>: Tue, 31 Mar 1998 11:39:37 +0900</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
At 09:12 PM 3/25/98 PST8PDT, you wrote:
&gt;On Tue, 24 Mar 1998, Adam Wiggins wrote:


&gt;&gt; Naturally the only downside to this is that you essentially need double
&gt;&gt; the RAM, but I see this as a pretty small concession, considering the price
&gt;&gt; of memory these days.
&gt;
&gt;The crucial part you are missing here, is how to do the snapshot?  You
&gt;still have to pass (copy) the data, either through a pipe or socket
&gt;or something.  It would probably be about as quick to just write it to
&gt;disk...  Of course, I could be wrong...
&gt;
&gt;Ben
&gt;

This is where you can have a little fun.  These records are people...
places.. things... whatever you need to use for your mud.  Each contains
references (unique ID's, not pointers) to other records.  Lets say that the
back end process ( the one that holds the "snapshot" ) holds a huge number
of records and the ones it dosnet have RAM for (if you dont have enough)
are written to disk.  Your front end process (the MUD) holds less, say
MAX_RECORDS.  Each time a refrence is dereferenced it checks the local
cache and if its not there its requests it from the back end process.  When
the number of local records exceeds MAX_RECORDS it drops the oldes ones (
LRU or Clock algorithms will do nicely).  Now dont panic... I see the
problems with this too.  There's more.

1) Whenever a record's reference is dereferenced, the front end process
fetches all the recrods associated with it... Thus, when you dereference
Boffo the Half-Troll you also bring over his moth eaten shirt.  His deadly
tree branch.  His manky underwear and the room he's in.  (because you will
proboly reference all of this very shorty after looking at Boffo) This way
when you make a reference its (probobly) always there...  

2) Whenever a record is changed it is marked as dirty and schedueled for
upload back to the back end... otherwise its just forgotten when it falls
off the LRU list.

Thus you only download from the backend the items you are useing and only
take a snapshot of the ones that change.

In the case of a crash, the process goes down (really quick)  It reboots
without any data (really quick) It recovers the still open descriptors to
the players ( really quick)  and it grabs the records for the players bodys
(wich prefetches the things they have and the rooms they are in) (also
quick since theres only a few records here) and thus you can reboot in
possibly under a second.   The DB is also current to the last write of
dirty records to the database (theres no reason this cant happen very
often) and if all goes well the crash seems like a second of netlag to the
players.  The mud is up and running (with maybe a 100 records for the
players and their eq and the rooms they are in...) and as they start to
move around and interact with the world all the thousands of records start
to migrate back from the back end...

The higher you set MAX_RECORDS the better the performance you get,  if you
have enough RAM for two full coppies of the mud and all its records then go
for it.  What you gain is the ability to reboot (possibly without the
players noticeing) and all you loose is the time it takes to upload dirty
records...

Sockets and pipes would work well for this but (I'm not sure) but I think
that unix messages will be very fast for this implimentation.

	Orion




</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00918" HREF="msg00918.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></strong>
<ul compact><li><em>From:</em> Ben Greear &lt;greear#cyberhighway,net&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00889" HREF="msg00889.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></STRONG>
<UL><LI><EM>From:</EM> Adam Wiggins &lt;nightfall#user2,inficad.com&gt;</LI></UL></LI>
<LI><STRONG><A NAME="00901" HREF="msg00901.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></STRONG>
<UL><LI><EM>From:</EM> Ben Greear &lt;greear#cyberhighway,net&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00916.html">UML &amp; CORBA</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00918.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00901.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00918.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00917"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00917"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="00858" HREF="msg00858.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Mon 23 Mar 1998, 20:43 GMT
</LI>
</ul>
<LI><strong><A NAME="00856" HREF="msg00856.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Mon 23 Mar 1998, 20:38 GMT
</LI>
<LI><strong><A NAME="00889" HREF="msg00889.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></strong>, 
Adam Wiggins <a href="mailto:nightfall#user2,inficad.com">nightfall#user2,inficad.com</a>, Wed 25 Mar 1998, 07:18 GMT
<UL>
<LI><strong><A NAME="00901" HREF="msg00901.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Thu 26 Mar 1998, 04:54 GMT
<UL>
<LI><strong><A NAME="00917" HREF="msg00917.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></strong>, 
Orion Henry <a href="mailto:orionZ#ix,netcom.com">orionZ#ix,netcom.com</a>, Tue 31 Mar 1998, 02:42 GMT
<UL>
<LI><strong><A NAME="00918" HREF="msg00918.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Tue 31 Mar 1998, 05:22 GMT
<UL>
<LI><strong><A NAME="00919" HREF="msg00919.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></strong>, 
Nathan F Yospe <a href="mailto:yospe#hawaii,edu">yospe#hawaii,edu</a>, Tue 31 Mar 1998, 18:23 GMT
<UL>
<LI><strong><A NAME="00925" HREF="msg00925.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Wed 01 Apr 1998, 04:41 GMT
</LI>
<LI><strong><A NAME="00926" HREF="msg00926.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></strong>, 
Vadim Tkachenko <a href="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</a>, Wed 01 Apr 1998, 05:33 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</ul>
</ul>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>