Jam*_*Gan 12 python google-app-engine google-cloud-datastore
今天早上,我的GAE应用程序生成了几个错误日志:"对这些数据存储区实体的争用太多了.请再试一次." 在我看来,这种类型的错误,当多个请求试图修改只发生在同一个实体或实体在同一个实体组.
当我收到此错误时,我的代码正在插入新实体.我糊涂了.这是否意味着我们创建新实体的速度有限制?
我的模型定义和调用序列代码如下所示:
# model defnition
class ExternalAPIStats(ndb.Model):
uid = ndb.StringProperty()
api = ndb.StringProperty()
start_at = ndb.DateTimeProperty(auto_now_add=True)
end_at = ndb.DateTimeProperty()
# calling sequence
stats = ExternalAPIStats(userid=current_uid, api="eapi:hr:get_by_id", start_at=start_at, end_at=end_at)
stats.put() # **too much contention** happen here
Run Code Online (Sandbox Code Playgroud)
这对我来说很神秘.我想知道如何处理这个问题.如果有任何建议,请告诉我.
以下是您需要了解的有关数据存储区争用以及如何避免它的所有信息:
https://developers.google.com/appengine/articles/scaling/contention?hl=en
希望能帮助到你
| 归档时间: |
|
| 查看次数: |
6179 次 |
| 最近记录: |