Object Prevalence: another persistence idea

Ned Konz ned at bike-nomad.com
Wed Aug 28 14:15:57 UTC 2002


A posting on the ruby-drb list alerted me to this...

One interesting idea for persistence (one possible Squeak 
implementation, and as I understand it after 10 minutes of reading) 
is this:

* Changes to business objects (that is, whatever you're trying to 
trying to persist/replicate) must be represented by serializable 
command objects (MessageSend, etc.).

* These commands are atomic transactions.

* The commands are passed to a method of the business object (probably 
added as an extension in Object) that knows about the persistence 
scheme. This method serializes the commands and appends them to a log 
file (see below). Then it executes the commands (or maybe it's the 
other way around, I'm not sure).

* Queries to business objects (and all other operations in the system) 
are normal Squeak method calls.

* Business objects live in the image, not on disk. Only their 
snapshots and incremental changes (see below) are stored to disk.

* Snapshots of the business objects are made from time to time using 
ImageSegments.

* Between the snapshots, serialized command objects are appended to a 
log file.

* Because commands are serialized, it is easy to have multiple 
synchronized distributed images that contain replicas of the business 
objects. This can provide load balancing for queries (like in a web 
application).

* Rollback or restore consists of loading the appropriate snapshot 
(Image Segment) and executing commands that were logged after that 
snapshot

This idea is simple and very high performance. It has been implemented 
in several languages:

Mnemonic  (Ruby)
http://www.papermountain.org/twiki/bin/view/Stuff/MnemonicHome 
 
Prevayler (Java)
http://www.prevayler.org/index.html 

According to the prevalyer wiki, Josh Flowers is thinking about making 
a Squeak port.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list