Google App Engine - increasing in Datastore operations

随声附和 提交于 2019-12-23 04:58:16

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/42484802/google-app-engine-increasing-in-datastore-operations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!