1998Q1/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] DBs and Events -->
<!--X-From-R13: "Tryvk O. Qebrf" <sryvkNkf1.fvzcyrk.ay> -->
<!--X-Date: Wed, 11 Feb 1998 20:59:11 +0000 -->
<!--X-Message-Id: 199802112058.VAA08210#xs1,simplex.nl -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] DBs and Events</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:felix#xs1,simplex.nl">
</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="msg00405.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00407.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00408.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00401.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00406">Author</A>
&nbsp;|&nbsp;<A HREF="#00406">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00406">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] DBs and Events</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] DBs and Events</LI>
<LI><em>From</em>: "Felix A. Croes" &lt;<A HREF="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</A>&gt;</LI>
<LI><em>Date</em>: Wed, 11 Feb 1998 21:58:23 +0100 (MET)</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
Nathan Yospe &lt;yospe#hawaii,edu&gt; wrote:
&gt; On Tue, 10 Feb 1998, Greg Munt wrote:
&gt; :On Tue, 10 Feb 1998, Nathan Yospe wrote:
&gt;
&gt; :&gt; On Tue, 10 Feb 1998, Greg Munt wrote:
&gt;
&gt; :&gt; :Also, any references to caches?
&gt;
&gt; :&gt; Again, can't help you. I've done caches, but not for my mud... and there
&gt; :&gt; is such a broad spectrum of things that qualify as cache. Do you want to
&gt; :&gt; know more about cached in-memory storage for a disk-based DB? 
&gt;
&gt; :Yes.
&gt;
&gt; The best sources for this would be J C, any of the Cold people, or, if a
&gt; member of the DGD development team is still around... was that the LPmud
&gt; disk-based project?

There never actually was a DGD development team, unless a team can be
one person.  But yes, still here.

All data in DGD is local to objects.  Storage in the "swap file" is
allocated in sectors of a certain size; each object in the swap file
takes up at least one sector.  This imposes considerable overhead,
since not all sectors will be fully used, but it allows for sector
allocation and deletion to be O(1) operations.  Moreover, the sector
size can be set to (a power-of-two portion of) the filesystem sector
size.

When an object is loaded from the swap file, the relevant sectors are
loaded in the sector cache, which is organized as a FIFO queue with
a given maximum size.  Whenever a sector is accessed, it is placed at
the tail of the queue.  Sectors that drop off at the head are written
to the swap file if necessary, and then discarded from the queue.

From the information in the sectors, the object is loaded in memory.
Only those parts that are actually used are loaded, so most objects
will be partially expanded.  Whenever a part is accessed that is
not yet in memory, the relevant sector is found (also a O(1)
operation) and loaded in the sector cache, after which the data
is extracted.  Data in sectors is stored in a packed format to
save space.

Objects in memory are linked in a priority queue.  Each time an
object is accessed, its priority increases, which may mean that
it changes places with one or more objects in front.  Every second
or so, a portion of objects at the head of the queue is swapped
out: the data of the object is written to one or more sectors,
and the in-memory copy of the object is discarded.  The portion
of objects that will be swapped out is fixed: for instance, if
the portion of objects swapped out is 1/100th, and there are
N objects in memory, N/100 will be swapped out.  This means
that there is always some swapping going on, unless there are
less than 100 objects in memory.

DGD's swap file is not actually a proper database, since it
doesn't contain enough information to restart the server with.
A proper database ("dump file" in DGD's terminology) is created
at a checkpoint: the swapfile is brought in a consistent state
by copying all new or changed objects back to it without actually
discarding them from memory, after which all dirty sectors in
the sector cache are written to the swapfile.  Thereafter,
some additional tables are quickly appended at the end of the
swapfile, and some header info is written to the first sector.
The swapfile is then renamed to the dump file, and a new
swapfile is then created by copying sectors from the dump file
at low priority.  In this fashion, a checkpoint can be performed
without forking, and without taking the mud down (it may take
only a few seconds, depending on the amount of objects in memory
and the size of the sector cache).

Felix Croes (DGD development team)

</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00405.html">Re: [MUD-Dev] Source Code Release</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00407.html">Re: [MUD-Dev] Source Code Release</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00408.html">[RESEARCH]MUD articles archive (fwd)</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00401.html">META: Unsubscribed users dur to bounces</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00406"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00406"><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><A NAME="00430" HREF="msg00430.html">Re: [MUD-Dev] Source Code Release</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 12 Feb 1998, 07:10 GMT
<LI><strong><A NAME="00429" HREF="msg00429.html">byte-code anyone?</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 12 Feb 1998, 07:05 GMT
<UL>
<LI><strong><A NAME="00473" HREF="msg00473.html">Re: [MUD-Dev]  byte-code anyone?</A></strong>, 
Jon Leonard <a href="mailto:jleonard#divcom,umop-ap.com">jleonard#divcom,umop-ap.com</a>, Mon 16 Feb 1998, 04:14 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00408" HREF="msg00408.html">[RESEARCH]MUD articles archive (fwd)</A></strong>, 
Greg Munt <a href="mailto:greg#uni-corn,demon.co.uk">greg#uni-corn,demon.co.uk</a>, Wed 11 Feb 1998, 21:24 GMT
<LI><strong><A NAME="00406" HREF="msg00406.html">Re: [MUD-Dev] DBs and Events</A></strong>, 
Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Wed 11 Feb 1998, 20:59 GMT
<LI><strong><A NAME="00401" HREF="msg00401.html">META: Unsubscribed users dur to bounces</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Wed 11 Feb 1998, 18:40 GMT
<UL>
<LI><strong><A NAME="00428" HREF="msg00428.html">Re: [MUD-Dev]  META: Unsubscribed users dur to bounces</A></strong>, 
Adam Wiggins <a href="mailto:nightfall#user2,inficad.com">nightfall#user2,inficad.com</a>, Thu 12 Feb 1998, 07:00 GMT
</LI>
</UL>
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00423" HREF="msg00423.html">META: Unsubscribed users dur to bounces</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Thu 12 Feb 1998, 02:19 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00398" HREF="msg00398.html">No Subject</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Wed 11 Feb 1998, 02:11 GMT
</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>