关于将实体分为两个以提高性能的GAE。(golang)

关于将实体分为两个以提高性能的GAE。(golang)

问题描述:

I have an entity Account which Contain mainly two groups of information.

Account {
    a1 // Group 1 rarely change
    a2
    a3
    a4
    ...
    b1 // Group 2 change frequently
    b2
    b3
    b4
    ...
}

First group is general info which will not update too frequent but group two will be changing frequently.

I wonder if I should extract Group 2 into another entity and store the key in Account so when I update group 2, I only need to put() the data of group 2.

My concern is, almost all operation to server would mostly require data from both group 1+2. If I split Account into 2, I need to do two get() to retrieve both data.

I know that read form data store is much inexpensive than write. But splitting the entity don't reduce the call to put(). In this case, I don't know if I should focus performance on put() or get().

Thanks

我有一个实体帐户,主要包含两组信息。 p>

   Account {
 a1 //组1很少更改
 a2 
 a3 
 a4 
 ... 
 b1 //组2经常更改
 b2 
 b3 
 b4 
 ..  。
} 
  code>  pre> 
 
 

第一组是一般信息,更新不会太频繁,但是第二组会经常更改。 p>

我想知道是否应该将第2组提取到另一个实体中并将密钥存储在Account中,以便在更新第2组时,我只需要将第2组的数据放入()。 p>

我的 值得关注的是,几乎所有对服务器的操作都将同时需要来自1 + 2组的数据。 如果将Account拆分为2,则需要执行两个get()来检索两个数据。 p>

我知道读取表单数据存储比写入便宜得多。 但是拆分实体不会减少对put()的调用。 在这种情况下,我不知道应该将性能集中在put()还是get()上。 p>

谢谢 p> div>

If the data in group 1 doesn't change, indexes don't get updated, so there's no monetary cost involved with updating them, while there is a cost to doing the second fetch.

You always need all the data so it doesn't make sense for you to split them.

The benefit you would get from splitting would be in performance. Fetching/putting a small entity takes less time than a big entity. So, for example, if Group 1 was really big (as in total size in bytes) and you didn't need the data, you could improve your performance by only fetching/putting an entity with Group 2. This doesn't sound like your scenario.

If say group 1 was 500KB, I'd consider splitting it. Although if you have to fetch group 1 all the time anyways, that nullifies the benefit.