谷歌应用程序引擎过度小型数据存储操作 [英] Google app engine excessive small datastore operations

查看:95
本文介绍了谷歌应用程序引擎过度小型数据存储操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google应用引擎数据存储区遇到了一些问题。自从推出新的定价模式以来,运行我的应用程序的成本大幅增加。

罪魁祸首似乎是数据存储小操作,它进一步每天超过两千万个操作!

有没有人有这个问题,我认为我没有做过多的密钥查找,而且我只有5000个用户,大概有10 - 20个请求每分钟。

提前致谢!

编辑



确定了一些统计数据,这些数据是在3小时之后。以下是我在仪表板中的结算部分看到的内容:



以下是一些统计数据:



很明显,对datastore.get有很多调用。我开始认为这是我的设计造成的问题。那些获得对应的帐户。每个用户都有一个帐户,但帐户可以是两种类型之一,因此我使用组合。所以每个账户实体都有一个到其子账户实体的链接。
因此,当我搜索附近的用户时,它涉及使用查询获取帐户,然后在每个帐户上获取其子帐户。统计图片中最重要的要求是获得100个帐户的电话,然后必须对每个帐户进行一次获取。我原以为这是一个非常轻的查询,但我猜不是。我仍然对我的仪表板中记录的数据存储小操作数量感到困惑。

无论您使用的是什么库,它都会告诉您您的处理程序正在执行哪些操作。最可能的罪魁祸首是按键查询和计数操作。


I'm having some trouble with the google app engine datastore. Ever since the new pricing model was introduced, the cost of running my app has increased massively.

The culprit appears to be "Datastore small operations", which come in at more than 20 Million ops per day!

Has anyone had this problem, I don't think I'm doing an excessive amount of key lookups, and I only have 5000 users, with roughly 10 - 20 requests per minute.

Thanks in advance!

Edit

Ok got some stats, these are after abut 3 hours. Here is what I am seeing in my dashboard, in the billing section:

And here are some of the stats:

Obviously there are quite a lot of calls to datastore.get. I am starting to think that it is my design that is causing the problem. Those gets correspond to accounts. Every user has an account, but an account can be one of two types, for this I use composition. So each account entity has a link to its sub account entity. As a result when I do a search for nearby users it involves fetching the accounts using the query, and then doing a get on each account to get its sub account. The top request in the stats picture is a call that gets 100 accounts, and then has to do a get on each one. I would have thought that this was a very light query, but I guess not. And I am still confused by the number of datastore small ops being recorded in my dashboard.

解决方案

Definitely use appstats as Drew suggests; regardless of what library you're using, it will tell you what operations your handlers are doing. The most likely culprits are keys-only queries and count operations.

这篇关于谷歌应用程序引擎过度小型数据存储操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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