“Too much contention” when creating new entity in dataStore

后端 未结 2 1065
梦如初夏
梦如初夏 2021-01-08 01:21

This morning my GAE application generated several error log: \"too much contention on these datastore entities. please try again.\". In my mind, this type of error only happ

相关标签:
2条回答
  • 2021-01-08 01:45

    Without seeing how the calls are made(you show the calling code but how often is it called, via loop or many pages calling the same put at the same time) but I believe the issue is better explained here. In particular

    You will also see this problem if you create new entities at a high rate with a monotonically increasing indexed property like a timestamp, because these properties are the keys for rows in the index tables in Bigtable.

    with the 'start_at' being the culprit. This article explains in more detail.

    Possibly (though untested) try doing your puts in batches. Do you run queries on the 'start_at' field? If not removing its indexes will also fix the issue.

    How is the puts called (ie what I was asking above in a loop, multiple pages calling)? With that it might be easier to narrow down the issue.

    0 讨论(0)
  • 2021-01-08 01:48

    Here is everything you need to know about Datastore Contention and how to avoid it: https://developers.google.com/appengine/articles/scaling/contention?hl=en (Deleted)

    UPDATE: You are reaching writes per second limit on the same entity group. Default it is 1 write per second. https://cloud.google.com/datastore/docs/concepts/limits

    Source: https://stackoverflow.com/a/47800087/1034622

    0 讨论(0)
提交回复
热议问题