1998Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] Persistant storage.... My current idea. -->
<!--X-From-R13: X Q Znjerapr <pynjNhaqre.rate.ftv.pbz> -->
<!--X-Date: Fri, 03 Apr 1998 17:57:55 +0000 -->
<!--X-Message-Id: 199804031757.JAA47846#under,engr.sgi.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: Pine.LNX.3.96.980402214938.282A&#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] Persistant storage.... My current idea.</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:claw#under,engr.sgi.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="msg00009.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00011.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00009.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00013.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00010">Author</A>
&nbsp;|&nbsp;<A HREF="#00010">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00010">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] Persistant storage.... My current idea.</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] Persistant storage.... My current idea. </LI>
<LI><em>From</em>: J C Lawrence &lt;<A HREF="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</A>&gt;</LI>
<LI><em>Date</em>: Fri, 03 Apr 1998 09:57:35 -0800</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
On Fri, 3 Apr 1998 01:18:08 PST8PDT 
Ben Greear&lt;greear#cyberhighway,net&gt; wrote:

&gt; On Wed, 1 Apr 1998, J C Lawrence wrote:
&gt;&gt; A very simple cheat which performs very nicely is to do something
&gt;&gt; as follows:
&gt;&gt; 
&gt;&gt; Every record in the DB is identified by a unique record # of a
&gt;&gt; signed integer type.
&gt;&gt; 
&gt;&gt; The DB consists of two files, the database itself, and an index.
&gt;&gt; 
&gt;&gt; The index file is an array of the following structures:
&gt;&gt; 
&gt;&gt;   struct { 
&gt;&gt;     off_t record_pos; // Offset of the record in the DB 
&gt;&gt;     size_t record_len; // Length of the record in the DB 
&gt;&gt;   }
&gt;&gt;
&gt; I still see no reason to store the index on disk.  

Learn the lessons of Marcus Ranum and UnterMUD.  Diask-based servers
can and do significantly out-perform in-RAM servers due to the lower
rate of page faults -- despite the file IO overhead.  Of the current
server architectures Cold is a perfect example in point.  cf Brandon's 
and Miro's oft referenced performance figures for Cold.

&gt; It just means
&gt; another write everytime I modify the DB significantly.  My hash
&gt; table will be exactly that however, just stored in RAM instead of
&gt; disk.

Sure.  You can update the index file on every record write, you can
lazy write it, you can do other forms of cacheing, you can delay all
writes until full-scale DB commit time... There are many possible
approaches.  The value of the seperate index is that the cost of
accessing any record, no matter where it is in the DB is now
constant.  Other indexiong forms have other expense patterns.

&gt;&gt; The N'th structure in the index file, located by seeking to an
&gt;&gt; offset of (N *sizeof (struct)) and then reading sizeof (struct)
&gt;&gt; bytes, holds the data for the record in the DB with a record number
&gt;&gt; of N.

&gt; The object id numbers will not be synchronus, indeed, they will vary
&gt; wildly as the high bits will be the server id, and the low bits will
&gt; be the object id on that server.  I'll probably use longs or two
&gt; integers, eight bytes at any rate.

Really?  Does this mean that objects migrate between servers?  Think
this thru:

  Object A is defined on Server X.

  A inherits from objects Q, R, S, and T, also defined on X.

  You now move A to server Y.

  Do Q, R, S and T, __and__ all their other children follow?

  What about all the objects that remain on X that inherit from those
objects too?

  Do you merely make copies of A, Q, R, S, and T, on Y, and leave the
originals on X?

  What do you do when the state of A  updates on X to also update Y?

  What do you do when the state of A updates on Y to also update X?

  What about is someone re-programs Q causing all children to also
alter?

   What happens when server Z comes along and wants to take/copy A etc 
from Y?

Please, have a good long look at COOL, and realise its strengths and
weaknesses.  COOL's model is expensive on net traffic, but objects tay
where they are defined, allowing their contexts to be known and well
defined.  All object calls are then RPC's across the net.  

This is not to say that moving the objects is automatically a bad
idea.  It has significant benefits over RPC'ing everythinbg -- it just
also requires significantly more engineeing effort to maintain logical
consistency.

&gt;&gt; New records are added into either the first free space in the DB
&gt;&gt; file that is large enough to hold them, or some "best fit"
&gt;&gt; equivalent.  As old records are deleted this opens "spaces" that
&gt;&gt; new records (with potentially very different record numbers) will
&gt;&gt; be inserted into.  Order has no importance in the DB file -- that
&gt;&gt; is what the index file is for.

&gt; I'm just going to put them on the end.  I'd wrather waste disk space
&gt; than take the time to be clever.  Besides, as the objects' images on
&gt; the disk will change, I'll need some room to grow and shrink w/out
&gt; affecting the neighbors.

Why?  If you use the suggested model there is very little overhead to
finding a free location for an object (when I did this I merely
maintained a free block list for a total expense of perhaps 20 LOC).
There is also no concern with object size changes:

  Object A exists.
  Object A changes into A'.
  A new space in the DB is found to hold A'.
  A' is written there.
  The entry for A in the DB is marked as deleted.
  The index for Z is updated to point at the new A'.

Neighbors are never affected.

&gt;&gt; I now have a dedicated 'net connection at home.

&gt; Damn, I'm jeleous...

56K dialup, static IP, $60/mo (www.rahul.net (Yes, Rahul Dhesi of
DECUS fame)).  

&gt;...gotta give Cox and US west a swift kick in the
&gt; arse..saw 2 MBS connection (wireless T1) for $360 a month..but it
&gt; would have to make money to be attractive to me....  Just wait for
&gt; DSL or the cable modems..whichever get here first :)

ADSL has not quite reached my part of the SF Bay area (its close), but
that's $180 for 384Kbps symmetrical (it varies slightly depending on
who you pick for your CLEC: PacBell, Covad, or NorthPoint).  IDSL
(which I'd be more likely to go for), has yet to establish a firm
pricing model here alas.

-- 
J C Lawrence                               Internet: claw#null,net
(Contractor)                               Internet: coder#ibm,net
---------(*)                     Internet: claw#under,engr.sgi.com
...Honourary Member of Clan McFud -- Teamer's Avenging Monolith...

</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="00013" HREF="msg00013.html">Re: [MUD-Dev] Persistant storage.... My current idea.</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="00009" HREF="msg00009.html">Re: [MUD-Dev] Persistant storage.... My current idea.</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="msg00009.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00011.html">[MUD-Dev] Persistant storage.... My current idea.</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00009.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00013.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00010"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00010"><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="00014" HREF="msg00014.html">OT: This is a test of a system config change.</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Sat 04 Apr 1998, 05:40 GMT
<LI><strong><A NAME="00008" HREF="msg00008.html">Monthly FAQ Posting</A></strong>, 
Ling <a href="mailto:K.L.Lo-94#student,lboro.ac.uk">K.L.Lo-94#student,lboro.ac.uk</a>, Thu 02 Apr 1998, 14:27 GMT
<LI><strong><A NAME="00007" HREF="msg00007.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Wed 01 Apr 1998, 22:58 GMT
<UL>
<LI><strong><A NAME="00009" HREF="msg00009.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Fri 03 Apr 1998, 09:11 GMT
<UL>
<LI><strong><A NAME="00010" HREF="msg00010.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Fri 03 Apr 1998, 17:57 GMT
<UL>
<LI><strong><A NAME="00013" HREF="msg00013.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Sat 04 Apr 1998, 01:32 GMT
<UL>
<LI><strong><A NAME="00049" HREF="msg00049.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Tue 07 Apr 1998, 16:56 GMT
<UL>
<LI><strong><A NAME="00063" HREF="msg00063.html">Re: [MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Wed 08 Apr 1998, 00:50 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00011" HREF="msg00011.html">[MUD-Dev] Persistant storage.... My current idea.</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Fri 03 Apr 1998, 23:42 GMT
</LI>
</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>