Re: paper on Prevayler

Karl Wettin <[email protected]> Fri, 8 Aug 2014 13:50:58 +0200
Newsgroups gmane.comp.java.prevayler
Message-ID <[email protected]>
On 07 Aug 2014, at 00:11, Justin Sampson <[email protected]> wrote:

> As long as the important
> logic is happening outside of a transaction, it's trivial to
> ensure that the transaction itself is deterministic. You just
> have to watch out for consistency/isolation vs. other business
> operations, which Prevayler otherwise gives you for free.


I currently work on a real estate search engine that get the input data from harvesting advertisements from realtor agency websites. As an advertisement is harvested I create a new transient object graph representing the current state of the advertisement. This transient object graph is passed down to a singleton delta evaluation class which is synchronously executed and produce a set of short setter type-transactions.

The logic in this synchronously executed delta evaluation block is speedy. Basically the code could have been a transaction instead, but then I would have to serialize the transient object graph representing the current state of an advertisement and execute not knowing if it would produce any changes. That would produce a huge journal as I visit all advertisements several times per day. Instead I have an optimal journal that loads really fast.

In previous versions I didn't run this delta evaluation synchronously. I didn't care if there was an error due to one harvester thread attempting to create an image, document or what not which was shared (pointing at the same URL) with another advertisement. If one thread managed to create such an object while another thread assumed it had not been created the later would receive an exception, fail fast and get it right the next time the advertisement was harvested. I allowed this because it felt as acceptable lag in the application.

But as I wrote, the delta evaluation is speedy. There is no problem what so ever to execute it synchronously as a singleton, and doing so also allows the code to be smaller and cleaner as I don't have to handle exceptions that might occur due to threads racing toward creating the same object.

It might have been a bigger problem for me if I was harvesting advertisements for a very large market, but I'm in tiny Sweden. Currently there are some 50 000 estates for sale in the country. If it was millions I would have to reconsider. Generally speaking, in a country as small as this even data sources generally considered big data is in reality small data. That's actually a rather joyful reoccurring theme for me.



		karl

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds

_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org