Thanks Enrique for your responses. I've done more research and it
seems that
- every write is serialized (regardless of within tx or not)
- contention will always exist at the Entity Group
- use retries to manage

On Jan 28, 5:28 pm, Enrique Perez <[email protected]> wrote:
> Ugorji,
>
> I agree with you that the documentation is not 100% clear.  In Google
> I/O 2008, Under the Hood of AppEngine Datastore, Ryan Barrett
> discusses transactions under the hood.  Toward the backend of the
> video (about 40 minutes in),  he talked about how transactions are
> implemented within the context of Entity Groups.  He discussed the
> notion of a transaction log that lives at the root entity of the
> Entity Group.  My understanding is that all transactional writes to an
> Entity Group, even to children in the entity group, will use this one
> transaction log during the transaction window.  Because of this you
> can get write contention, even if you just writing to child entities.
> This is my recollection after watching this video some months back...
> I could be missing something..  If anyone has additional insight
> please correct anything that may be wrong...
>
> Thanks
> Enrique Perez
> Austin, Texas
>
> On Jan 28, 7:11 pm, Ugorji <[email protected]> wrote:
>
>
>
> > Thanks Enrique for your response.
>
> > This seems to be what the app engine docs are alluding to, but they
> > are not specific on the writes when the parent entity is not part of
> > the transaction, and furthermore they suggest that optimistic
> > concurrency is used and not locking, which lends credence that if the
> > parent is not involved and just new entities are being created, there
> > should be no contention. I've watched some of the Google IO videos
> > also, and they seem to suggest that, but are not specific.
>
> >http://code.google.com/appengine/docs/whatisgoogleappengine.html
>
> > Looking at the link above, under the title "The Datastore", and I
> > quote:
>
> >   "An update of a entity occurs in a transaction that is retried a
> > fixed number of times if other processes are trying to update the same
> > entity simultaneously."
>
> > This suggests that optimistic concurrency only applies if multiple
> > processes are trying to update the *same* entity simultaneously.
> > Optimistic concurrency also *implies* that first one wins.
>
> > In my case, they are not trying to update the same entity, so it
> > shouldn't matter.
>
> > It seems the app engine docs are not clear on this, and I really want
> > to leverage the entity groups in this way. Maybe one of the Google
> > guys can help clarify this?
>
> > On Jan 28, 4:56 pm, Enrique Perez <[email protected]> wrote:
>
> > > My understanding is that all writes within the same entity group are
> > > serialized. Hence a best practice is keep Entity Groups as small as
> > > possible. If there is contention between two simulatanous writes to
> > > the same Entity Group, one fails, and having retry logic here will
> > > help get that second write to succeed .... In my experience a high
> > > percentage of write retries succeed on 2nd or 3rd retry....  Hopefully
> > > this helps...
>
> > > Thanks
> > > Enrique Perez
> > > Austin, Texas
>
> > > On Jan 28, 6:47 pm, Ugorji <[email protected]> wrote:
>
> > > > I want to put some entities in the same entity group as a parent. If
> > > > multiple users try to create child entities at the same time, will
> > > > their put requests all lock on the parent entity and get executed in
> > > > sequence (even though I am not making any changes to the parent? and
> > > > the parent does not hold references to the children). I would hope
> > > > not, but want some clarity on this.
>
> > > > If their put requests get run one at a time, will I have to
> > > > continually retry? I read somewhere that App Engine automatically
> > > > retries non-transactional requests on failures. However, I then read
> > > > here that we should retry our requests as is typical where optimistic
> > > > concurrency is 
> > > > used.http://code.google.com/appengine/docs/java/datastore/transactions.htm...
>
> > > > What are the rules on when a retry is needed? Are they needed anytime
> > > > I try to create a child entity without affecting the parent?- Hide 
> > > > quoted text -
>
> > - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to