When to use entity groups in GAE's Datastore

前端 未结 2 735
慢半拍i
慢半拍i 2021-01-02 01:17

Following up on my earlier question regarding GAE Datastore entity hierarchies, I\'m still confused about when to use entity groups.

Take t

2条回答
  •  一向
    一向 (楼主)
    2021-01-02 01:27

    Nick stated clearly that you should not make the groups larger than necessary, the Best practices for writing scalable applications has some discussion one why.

    Use entity groups when you need transactions. In the example you gave, a ReferenceProperty on employee will achieve a similar result.

    Aside from transactions, entity groups can be helpful because key-fetches and queries can be keyed off of a parent entity. However, you might want to consider multitenancy for these types of use-cases.

    Ultimately large entity groups might hurt scalability, entities within an entity group are stored in the same tablet. The more stuff you cram into one entity group, the more you reduce the amount of work that can be done in parallel -- it needs done serially instead.

提交回复
热议问题