System prevalence has a lot in common with event sourcing and cqrs. I’m not sure about how aware the two communities are of each other so I posted the following to the ddd/cqrs google group. Here’s a link to the post, in case you want to follow the discussion.
Howdy folks, Here’s a short presentation of System Prevalence, a concept you should definitely be familiar with. What if you had enough RAM to hold ALL of your aggregates in memory? According to the prevalent hypothesis you do! A prevalence engine …
- maintains a single aggregate (the prevalent system) in memory
- executes queries and command against the aggregate
- writes commands to the command journal
- reloads the aggregate by replaying commands from the journal on startup
There are a few very significant things implied here regarding concurrency and transactions:
- There is no separate database where your “real” data lives, the aggregate in memory IS the data. This means no concurrency/consistency conflicts
- The entire system is a single aggregate and therefore also a single transactional boundary.
- In memory is so fast that we can get away with an exclusive lock on the entire system for each command.
- Full ACID support
As you can see System Prevalence has some similarities with CQRS and Event Sourcing. Generally, there are fewer collaborating types in a prevalent system architecture:
- Engine
- Commands
- Queries
- the prevalent system (aggregate, remember?)
Notably, there are no command handlers or events. Of the CQRS/ES examples I’ve seen there is a lot of non-transparent complex event plumbing going on in the aggregates. Domain modeling for a prevalent system, on the other hand, is about as transparent as it gets. Prevayler (java), Madeleine (ruby), LiveDb (.NET) are a few of the many system prevalence implementations out there. (I’m the lead dev of LiveDB) Here are some links for additional reading:
- An introduction to object prevalence (2002!) http://www.ibm.com/developerworks/library/wa-objprev/
- System prevalence on wikipedia http://en.wikipedia.org/wiki/System_Prevalence
- Page on Ward Cunninghams wiki (a must read!) http://c2.com/cgi/wiki?ThePrevayler
- Prevayler - one of the first implemantations by visionary Klaus Wuestefeld www.prevayler.org
- The old prevayler wiki http://prevayler.org/old_wiki/Welcome.html
- LiveDB open source engine http://livedomain.codeplex.com
- Martin Fowler on LMAX
http://martinfowler.com/articles/lmax.html </p>- Hacker news comments on fowlers LMAX article http://news.ycombinator.com/item?id=3173993
- Martin Fowler calls it Memory Image http://martinfowler.com/bliki/MemoryImage.html
- What Klaus thinks the name MemoryImage https://gist.github.com/1186975
- Geekstream - LiveDB server example app http://geekstream.devrex.se
- Geekstream source on githubhttp://github.org/devrexlabs/geekstream
- Prevayler related stuff on Hacker News http://metaoptimize.com/projects/autotag/hackernews/term/88/prevayler.html