Hi Hari, There are several reasons people often suggest not putting lots of entities into the same entity group. - Everything in the same entity group will be stored together, so you will potentially lose some parallelism when doing some operations -- instead of multiple machines grabbing / writing your entities one will be doing it. - It can also impact you when you start trying to fetch by id, which is more efficient than querying. If your entities are in groups you need to know the parent id _and_ the child entity id. Of course, if you use the entity keys this is a non-issue.
Those are probably the two biggest things to consider. Robert On Sat, Dec 4, 2010 at 09:02, har_shan <[email protected]> wrote: > Thanks much Chris for clear expln! > > So it looks like i can place most of my entities of my app in same > entity group *provided* i don't require any concurrent update of any > particular entity group i.e. if user is gonna update only his content, > he will touch only his entity group so this will not cause any > contention (in most typical web applications this should be case, i > guess). > But why in general people recommend having multiple entity groups? > May be because it is ONLY for data like recording count of all web > requests which requires updating same entity (group) > for all user requests > Or am i missing to foresee something? > (like i might in future want to update several entities belonging to > same user concurrently, so when i put all in same entity group, in > future this wont work) > > Also can you please take a look at my other question and provide your > thoughts? > https://groups.google.com/group/google-appengine/browse_thread/thread/8a3eef7abe106596/d8310226f1418a20?hl=en#d8310226f1418a20 > > Thanks again, > Hari > > On Dec 4, 2:17 am, Chris Copeland <[email protected]> wrote: >> In your example you would have two entity groups: >> >> *Group 1: >> *Person: 1 Aravind >> Car: Ford #258 >> >> *Group 2: >> *Person: 2 Hari >> Car: Maruti #456 >> Car: Mercedes #456 >> >> When you create the Car entities, specify their parent as the Person entity >> that owns them. This is what places them in the same entity group. >> >> It is not necessary for the Car to have a explicit reference to the Person >> -- this can be handled with the Key alone. >> >> Now, if Aravind updates his car info, only Entity Group 1 will be "locked" >> and this will scale well since your entity groups are limited to one user's >> worth of data. >> >> -Chris >> >> >> >> >> >> >> >> >> >> On Fri, Dec 3, 2010 at 1:29 PM, har_shan <[email protected]> wrote: >> > Am learning GAE and got a bit confused on this. >> > Lets say i have a sample model >> >> > Person (parent) {id, name, List<Car>} >> > Car {make, model, Person} >> >> > (1 - m relationship) say >> >> > So both are in same entity groups (lets say i want to transact them >> > together). >> >> > Sample data: >> > Person: ID NAME >> > 1 Aravind >> > 2 Hari >> >> > Car >> > MAKE MODEL >> > Ford #258 {Aravind} >> > Maruti #456 {Hari} >> > Mercedes #456 {Hari} >> >> > According to >> >> http://code.google.com/appengine/articles/scaling/contention.html >> >> >> >> >> >> >> >> > 'Keep entity groups small' and also read in other places, >> > i see that when you update a entity in an entity group in a >> > transaction, entity group is locked, so when other process tries >> > updating same entity group it fails/aborts. >> >> > So my doubt is, does this mean that if Aravind updates his Car data, >> > then Hari can't update his Car data at the same time, since both >> > entities fall under same entity group (and hence it has to be retried >> > to get it passed). >> > (if above is true, does it mean that when above update is done >> > concurrently by say 1K users then most of them would fail!) >> >> > or i just understood it wrongly >> > and does this apply only to each individual's data i.e. in above e.g. >> > another process just can't update Aravind's Car data (when Aravind is >> > actually updating Car data) >> > but CAN update Hari's Car data (and hence other's Car data). >> >> > Thanks, >> >> > -- >> > You received this message because you are subscribed to the Google Groups >> >> "Google App Engine" group.> To post to this group, send email to >> [email protected]. >> > To unsubscribe from this group, send email to >> >> [email protected]<google-appengine%[email protected]> >> .> For more options, visit this group at >> >> http://groups.google.com/group/google-appengine?hl=en. >> >> >> >> >> >> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" 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?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" 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?hl=en.
