emacs.d/clones/lisp/www.cliki.net/CommonLispPrevalence.html

66 lines
7.8 KiB
HTML
Raw Normal View History

2022-10-07 15:47:14 +02:00
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CLiki: CommonLispPrevalence</title>
<link rel="alternate" type="application/atom+xml" title="ATOM feed of edits to current article"
href="https://www.cliki.net/site/feed/article.atom?title=CommonLispPrevalence">
<link rel="stylesheet" href="static/css/style.css">
<link rel="stylesheet" href="static/css/colorize.css">
</head>
<body>
<span class="hidden">CLiki - CommonLispPrevalence</span>
<div id="content"><div id="content-area"><div id="article-title">CommonLispPrevalence</div><div id="article">A way to let your lisp environment be your <a href="Database.html" class="category">Database</a>.<p>See also: <a href="cl-prevalence.html" class="internal">cl-prevalence</a>.<p> Most stuff here from the <a href="http://common-lisp.net/project/cl-prevalence/">Common Lisp Prevalence</a> website. This code was written by Sven Van Caekenberghe using <a href="OpenMCL.html" class="internal">OpenMCL</a>, an open source Common Lisp implementation for <a href="MacOS&#32;X.html" class="internal">MacOS X</a> (Darwin) and LinuxPPC. <a href="CMUCL.html" class="internal">CMUCL</a> is known to run this code successfully. <p> Release 1, June 10, 2003: First Public Release <p> This is a proof of concept implementation of <a href="https://en.wikipedia.org/wiki/System_prevalence">Object Prevalence</a>. Object Prevalence is a simple but interesting concept first proposed by Klaus Wuestefeld in 2001. IBM developerWorks has a reasonable <a href="https://web.archive.org/web/20060319015113/http://www-128.ibm.com/developerworks/library/wa-objprev/">Introduction to Object Prevalence</a> article. (But see also the 1987 paper by Birrell, Jones and Wobber entitled <a href="http://www.birrell.org/andrew/papers/024-DatabasesPaper.pdf">A Simple and Efficient Implementation for Small Databases</a> where most of these concepts are worked out in detail minus the cool sounding name! gwking).<p>The main Java implementation is called Prevayler, and it's available from <a href="http://prevayler.org/">here</a>. Prevayler claims whopping benchmarks, because it stores objects in RAM. However, Prevayler garantees that "if you pull the plug, your object will 'prevail' ." (This quote from Klaus from a magazine article). <p>Arthur Lemmens also gave an <a href="https://cl-pdx.com/static/persistence-lemmens.txt">overview</a> on the various Common Lisp ways to achieve object <a href="persistence.html" class="category">persistence</a>, covering these prevalence libraries.<p><ul>
<li> Most databases are only a couple of hundreds of megabytes big, often even less.</li>
<li> Most computers can easily take a couple of hundreds of megabytes of data in RAM, big servers can hold many gigabytes.</li>
<li> Mapping objects to databases is at least tedious and time consuming, but often also complex and error prone.</li>
<li> Let's throw away the database and just consider the domain model objects as the database.</li>
<li> Let's make sure we can serialize and deserialize our objects to and from a some persistent medium such as a file system.</li>
<li> If we store our complete set of domain model objects to a persistent medium we create a snapshot.</li>
<li> We query by using the data structure manipulation functionality of our programming language, running from RAM, queries will be extremely fast.</li>
<li> Let's agree to only change our object model using transaction objects that combine the data and the functionality to execute the transaction.</li>
<li> In order to preserve the ACID properties of our system, we log each transaction to some persistent medium by serializing it after we execute it. The is called the <em>transaction log</em>.</li>
<li> When the system goes down (intentionally or unintentionally) we restore its latest state by first reading in the latest snapshot and by re-executing each transaction from the transaction log.</li>
<li> Transactions must be deterministic and re-entrant (so they also need to record the current time if necessary).</li>
<li> In a multi-threaded system, transactions are globally serialized.</li>
</ul><p> NOTE: This is exactly what Smalltalk does (before 2001 :). <p> Another try at common lisp prevalence is available at the <a href="bknr.html" class="internal">bknr</a> website. It doesn't use XML serialization as Sven's code does, but instead writes LISP snapshot and transaction-log files that can be restored using <code>LOAD</code>.<p> An alternative to prevalence use an object database like <a href="Elephant.html" class="internal">Elephant</a>. <a href="Elephant.html" class="internal">Elephant</a> is transparent like prevalence (automatically serializing lisp values) but backed by Sleepycat/Berkeley DB, an embedded <a href="database.html" class="category">database</a>, as well
as relational databases. Since the cache is mapped to in-process memory, reads are very fast. Sleepycat is very mature, and supports many advanced features. <p>The simplest way to do a web site with persistent data is just to use the reader and printer to serialize your objects. You can go more complex than that, if you want, and that's what <a href="bknr.html" class="internal">bknr</a> does, for instance. <a href="lisppaste.html" class="internal">lisppaste</a> serializes its transactions as XML; <a href="https://www.cliki.net/cl-blog" class="new">cl-blog</a> just uses serialized sexprs. I have no idea what <a href="cliki.html" class="internal">cliki</a> looks like on disk.<p><a href="manardb.html" class="internal">manardb</a> may be a more efficient implementation of prevalence; it can also store very large datasets.<p><hr>
<a href="ObjectStore.html" class="category">ObjectStore</a></div></div>
<div id="footer" class="buttonbar"><ul><li><a href="CommonLispPrevalence.html">Current version</a></li>
<li><a href="https://www.cliki.net/site/history?article=CommonLispPrevalence">History</a></li>
<li><a href="https://www.cliki.net/site/backlinks?article=CommonLispPrevalence">Backlinks</a></li><li><a href="https://www.cliki.net/site/edit-article?title=CommonLispPrevalence&amp;from-revision=3765798165">Edit</a></li><li><a href="https://www.cliki.net/site/edit-article?create=t">Create</a></li></ul></div>
</div>
<div id="header-buttons" class="buttonbar">
<ul>
<li><a href="https://www.cliki.net/">Home</a></li>
<li><a href="https://www.cliki.net/site/recent-changes">Recent Changes</a></li>
<li><a href="CLiki.html">About</a></li>
<li><a href="Text&#32;Formatting.html">Text Formatting</a></li>
<li><a href="https://www.cliki.net/site/tools">Tools</a></li>
</ul>
<div id="search">
<form action="https://www.cliki.net/site/search">
<label for="search_query" class="hidden">Search CLiki</label>
<input type="text" name="query" id="search_query" value="" />
<input type="submit" value="search" />
</form>
</div>
</div>
<div id="pageheader">
<div id="header">
<span id="logo">CLiki</span>
<span id="slogan">the common lisp wiki</span>
<div id="login"><form method="post" action="https://www.cliki.net/site/login">
<label for="login_name" class="hidden">Account name</label>
<input type="text" name="name" id="login_name" class="login_input" />
<label for= "login_password" class="hidden">Password</label>
<input type="password" name="password" id="login_password" class="login_input" />
<input type="submit" name="login" value="login" id="login_submit" /><br />
<div id="register"><a href="https://www.cliki.net/site/register">register</a></div>
<input type="submit" name="reset-pw" value="reset password" id="reset_pw" />
</form>
</div>
</div>
</div>
</body></html>