cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Baldwin <jfbald...@earthlink.net>
Subject Re: lazy loading (slightly OT but still pretty important)
Date Fri, 30 Mar 2012 18:01:13 GMT
Hi Michael,

I just looked up the def of Optimistic Locking and it forwarded me to Optimistic Concurrency
Control (so I am not sure of the distinction just yet).  But I *think* that the behavior that
I have seen in my webapp would be your implementation of optimistic locking.

RE: "As for faulting data into memory, Cayenne will get the freshest data the DB has at that
point, excluding any pending transactional changes."

I think that this addresses our side-discussion about whether Cayenne "cares about stale data".
 My testing seemed to indicate that it does "care" (aka provide behavior that ensures that
the most recent DBMS managed data is represented).  And yes, my test assumed that the test
data was in fact committed (in this case by an independent MySQL client not associated with
Cayenne).

So if this is all true, then I was interested in Joachim's comment (as I understand it), that
suggests this might not be a sustainable method for performance (I presume in the context
of scaling data sets).

So from another point of view: my conception is that you have a subset of the Relational data
in hollow data objects (for performance reasons).  So to maintain both performance, low memory
usage, and data integrity - do you just keep the object reference and modify timestamp, and
then verify these very quickly - or is there a slicker way of doing this?

Thanks
Joe


On Mar 30, 2012, at 12:51 PM, Michael Gentry wrote:

> Hi Joe,
> 
> It mainly sounds like you care about optimistic locking.  Cayenne can
> use whichever columns you select to test for external changes upon an
> UPDATE.  As for faulting data into memory, Cayenne will get the
> freshest data the DB has at that point, excluding any pending
> transactional changes.  (Most databases will not make pending
> updates/inserts/deletes in another transaction visible to your
> transaction.)
> 
> mrg
> 
> 
> On Fri, Mar 30, 2012 at 11:16 AM, Joe Baldwin <jfbaldwin@earthlink.net> wrote:
>> OK, I am getting confused as to the subject that we are arguing.  My interest is
specifically with the thesis and conclusion:
>> 
>>>>> Cayenne doesn't care about staleness. ... If data isn't available yet,
just load it - and accept the risk that the application may now be working with partly stale,
partly current data.
>> 
>> 
>> My comment (with warning that I have not made rigorous tests), is that if Cayenne
is recognizing data that has been externally changed (i.e. not via Cayenne front door). If
it can do this, then it does seem to have supporting behavior for addressing "staleness".
What the details of that behavior are, I do not know.  It does seem that the behavior is present
though.
>> 
>> Am I missing something?
>> Joe
>> 
>> 
>> 
>> 
>> 
>> On Mar 30, 2012, at 9:53 AM, Durchholz, Joachim wrote:
>> 
>>>>> Cayenne doesn't care about staleness. It's the application's
>>>>> task to ensure that Pojo networks are updated to the current
>>>>> DB state at the beginning of an application-side transaction.
>>>>> If data isn't available yet, just load it - and accept the
>>>>> risk that the application may now be working with partly
>>>>> stale, partly current data.
>>>> 
>>>> Are you sure that this is correct?
>>> 
>>> I'm not, I'm just inferring that from the fact that
>>> a) Cayenne is recreating connections as needed, so it cannot rely on transactional
repeatable-read properties and
>>> b) assuming that rechecking all cached records for being up-to-date whenever
anything else is loaded or stored.
>>> 
>>>> And in the critical data, Cayenne is able to present the
>>>> DBClient modified data immediately.
>>> 
>>> This may be a side effect of having a webapp.
>>> It might be reloading all data on each request (that's what webapps often do).
Or it might be refreshing all relevant data on each request.
>>> 
>>>> For the most part, I have seen that the *default* Cayenne
>>>> behavior handles the "stale" issue pretty well.  (This is,
>>>> if changing data directly in the database, and then having
>>>> Cayenne immediately display it via a webpage is an
>>>> appropriate black-box test)
>>> 
>>> If that works without explicit programming, that would be awesome!
>>> But how would Cayenne achieve that and still have reasonable performance?
>> 


Mime
View raw message