ReadConsistency and entity load performance?

18 views
Skip to first unread message

Peter Murray

unread,
Jul 5, 2011, 1:01:35 PM7/5/11
to google-a...@googlegroups.com

Greetings folks,

It seems that entities load almost ten times faster when using ReadPolicy.Consistency.EVENTUAL in the DatastoreServiceConfig.  In my little test, using the default of STRONG, loading 100 Entities by key (e.g. ds.get(keys) ) takes around 500ms (plus or minus), but with EVENTUAL it seems to be about 50ms.  My question is, with the HR datastore, what are the practical differences between STRONG and EVENTUAL when the entities are not in a single entity-group anyway?  I wonder why the big difference in lookup by key performance between the two?   Could it be that under HR most lookups could be done with EVENTUAL read consistency?

Thanks!

-pete

Robert Kluin

unread,
Aug 6, 2011, 11:44:39 PM8/6/11
to google-a...@googlegroups.com
Hi Peter,
There is a very big difference. Strong consistency will ensure you
are seeing the most recent version of the data in that entity group;
if a strongly consistent request hits a server that does not have the
most recent version of an entity group's data it will cause that
server to 'catch up' before it returns the results. What this boils
down to is that strong consistency means all reads are done in a
transaction, which means one transaction for each entity group.

Eventual consistency means you'll get whatever data is on the
datastore node the request hits. That data may be the latest or it
might be out-of-date -- no guarantees are made. It also will not
cause that node to catch up if it is out-of-date.

Some things can tolerate eventual consistency, others can not. Up
to you to decide if you'd prefer the faster reads.


Robert

> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/9x6eQ4EBia8J.
> To post to this group, send email to google-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengi...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

Reply all
Reply to author
Forward
0 new messages