Google App Engine - 增加数据存储操作 [英] Google App Engine - increasing in Datastore operations

查看:143
本文介绍了Google App Engine - 增加数据存储操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我们首次在Google App Engine中收费,主要原因似乎是对 Datastore 的创建,读取和删除操作。



我试图弄清楚是什么导致了这种情况 - 或者是谈论数百万个奇怪的操作。



我们每天有半个工作会删除750个实体并编写750个新实体,所以我相信它应该处理一些事情 - 但即使如此,它又如何能达到数百万?



另一个问题是 - 如果我使用远程API,对 Datastore 操作有任何额外影响?



我们必须减少这个数字,因为我们只有10-15个测试用户,而且我们现在无法承担这笔费用。

我想听到我们应该检查可能会导致此操作的任何建议。



谢谢

解决方案

原因可能是复合inde x在列表属性上。



想象你有:

  MyModel: 
Prop1:vals列表
Prop2:vals列表
Prop3:val列表

并且在(Prop1,Prop2,Prop3)上有一个复合索引。



如果你推入一个单一的实体,像 MyModel prop1 = [1,2,3],prop2 = [4,5,6,7],prop2 = [8,9,10,11,12])它会产生:

  2写入操作键
3 * 2写入操作
3 * 4 * 5为复合写入操作index
=====================
共68个写操作

在列表属性中使用复合索引时,您会以几何级数形式写入操作,这会导致索引的组合式爆炸。


Today, we've been charged for the first time in Google App Engine, and the main cause seems to be Create, Read and Delete operations to the Datastore.

I'm trying to figure out what cause this - or talking about millions of operations which is weird.

We have half-daily task which delete 750 entities and write 750 new entities, so I believe its something we should take care of - but even then, how can it come to millions?

Another question is - if I'm using remote api, there is any extra affect on the Datastore operations?

We must reduce this number cause we are only 10-15 testing users and we cannot afford this costs at this point at all.

I'd like to hearing any suggestions from your experience, or thing we should check that may cause this operations.

Thanks

解决方案

The reason could be a composite index on list properties.

Imagine you have:

MyModel:
  Prop1: list of vals
  Prop2: list of vals
  Prop3: list of vals

and have a composite index on (Prop1,Prop2,Prop3).

If you push a single entity like MyModel(prop1=[1,2,3], prop2=[4,5,6,7], prop2=[8,9,10,11,12]) it would produce:

2 write ops for key
3*2 write ops for props
3*4*5 write ops for composite index
=====================
Total of 68 write ops

With composite indexes on list properties you have write ops in geometrical progression and this can cause combinatorial explosion of index.

这篇关于Google App Engine - 增加数据存储操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆