Friday, July 08, 2005

Prevayler for .Net

Prevayler is a persistence engine that is a cool alternative to a database. It boasts performance of about 3000 x faster than MySQL (if I remember correctly).

The basic premise is that RAM is cheap (and if not today it will be tomorrow) so keep all your business objects alive in RAM all of the time. To handle server crashes you regularly make snap shots of the server. You employ a command pattern for all actions that cause changes to the state of the system. The commands are serializable, so they get logged before they are executed. If the server goes down, you load the last snapshot and then replay the commands in the log since the last save and there you have it, the server is back to the same running state.

You don't even need to stop the server to take the snapshot. You just run another copy of the prevayler (loaded from the last snap shot) get it to run up to speed using the log, then stop processing the log and save again.

Since everything is live in memory all the time, asking a customer for all his orders is as simple as accessing the Customer.Orders property.

Check out the Skeptics FAQ for more discussion.

Check out http://bbooprevalence.sourceforge.net/ for a .Net implementation.
Post a Comment

GitHub Projects