Three questions about AppEngine datastore and benefits / cost of EntityGroups?

5 views
Skip to first unread message

Enrique Perez

unread,
Nov 22, 2009, 4:47:01 PM11/22/09
to Google App Engine, tristan....@gmail.com
I understand EntityGroups allow you to use transaction management
across multple writes of different kinds. This is clear benefit but I
am trying to understand some more subtle benefits/costs of using
EntityGroups.

Question 1: When you define a chain of ownership between an entity and
child entity, is the entity group defined at the root entity level or
the "kind" level. For example of you have "kind" called "Book" and a
child kind "Chapter" defined. If you have a "Book" entity named
"Intro to AppEngine", and it has three child entitles, "Ch1", "Ch2",
and "Ch3", is there 1 entityGroup containing "Intro to AppEngine" with
its 3 child entities or is the entityGroup at the 'book" level where
it contains all entities of kind "book" along with all of the child
entities?

Question 2: Assuming you have an entityGroup with a chain of ownership
of 3 different kinds. Does the write throughput vary based on whether
we are using transactions or not. When Max Ross at Google I/O
described write throughput on an entityGroup being from anywhere from
1 to 10 writes per second, were these numbers based on writes using
appengine datastore transaction management or were these numbers based
on writes without transactions.

Question 3: The second question involves queries against data in an
entity group. In the relational database world, some databases allow
you to partition data within a table. The advantage of this, if done
properly, is that queries against those tables result in scans against
specific partitions (given parameters in where clause) as oppossed to
full table scans across all data in the table. The query can perform
much better with these partitions in place. With respect to the
AppEngine datastore, do we get a performance boost with queries whose
entities all reside within a single entity group?

Thanks
Enrique Perez



Robert Kluin

unread,
Nov 22, 2009, 11:52:46 PM11/22/09
to google-a...@googlegroups.com
Enrique,
    Q1: The datastore stores members of the same entity group together.  If I correctly understand what you are asking, the entity group is defined by the child entity itself.  In other words book does not "contain" chapters, but rather each chapter knows which book (if any) is its parent.  A book might have another book, or even a chapter, as its parent since entity groups are just defined by keys. 

    Q3: I think it might depend on exactly what you are doing.  However, everything I have read indicates that putting too much stuff in the same entity group will not generally help your performance, but may actually hurt it.  App engine requires you to build indexes for all of your non-trivial queries anyway, so I think this addresses the issue you are concerned about.
 
Robert





--

You received this message because you are subscribed to the Google Groups "Google App Engine" group.
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=.



Julian Namaro

unread,
Nov 23, 2009, 11:29:38 PM11/23/09
to Google App Engine


> Question 1: When you define a chain of ownership between an entity and
> child entity, is the entity group defined at the root entity level or
> the "kind" level. For example of you have "kind" called "Book" and a
> child kind "Chapter" defined. If you have a "Book" entity named
> "Intro to AppEngine", and it has three child entitles, "Ch1", "Ch2",
> and "Ch3", is there 1 entityGroup containing "Intro to AppEngine" with
> its 3 child entities or is the entityGroup at the 'book" level where
> it contains all entities of kind "book" along with all of the child
> entities?

The grouping is at the level of entities, not models(hence the name).
In your example the Book entities will be stored in various Datastore
nodes, only "Intro to AppEngine" with its 3 child entities "Ch1/Ch2/
Ch3" are guaranteed to be grouped together in the same Datastore node.

> Question 2: Assuming you have an entityGroup with a chain of ownership
> of 3 different kinds. Does the write throughput vary based on whether
> we are using transactions or not. When Max Ross at Google I/O
> described write throughput on an entityGroup being from anywhere from
> 1 to 10 writes per second, were these numbers based on writes using
> appengine datastore transaction management or were these numbers based
> on writes without transactions.

I assume it does vary; transactions are inherently slower and can
fail.
I think the threshold is that you will get into trouble if you use
transactions on entity groups that get more than 1 write per second.

> Question 3: The second question involves queries against data in an
> entity group. In the relational database world, some databases allow
> you to partition data within a table. The advantage of this, if done
> properly, is that queries against those tables result in scans against
> specific partitions (given parameters in where clause) as oppossed to
> full table scans across all data in the table. The query can perform
> much better with these partitions in place. With respect to the
> AppEngine datastore, do we get a performance boost with queries whose
> entities all reside within a single entity group?

The only difference for queries is that the entities are stored at the
same location. As the entities matching a query are fetched in
parallel, this will not result in a performance boost, and might
actually be slower.
Reply all
Reply to author
Forward
0 new messages