Hello Remko, Contention errors are usually observed when updating entities too rapidly, or when high read or write rates to lexicographically close documents. Since you recently changed the library to Cloud NDB, you may review this migration guide [1] which outlines key differences. One of these differences is that data caching is now done in a Redis in-memory datastore managed by Memorystore instead of the legacy App Engine Memcache service. You may therefore make sure appropriate changes have been made accordingly.
You may also look at the Datastore Best Practices [2] which discusses contention directly. To make sure that your application follows the limit of the new Firestore in Datastore mode limits, you may review those here [3] to make sure that other potential services are interacting with Datastore according to those limits. Firestore in Datastore mode is a different architecture than the legacy Datastore so understanding those are crucial for a smooth transition. Finally, you may review the official documentation for the Cloud NDB library [4] to make sure that entities, keys, and properties are properly defined. [1] https://cloud.google.com/appengine/docs/standard/python3/migrating-to-cloud-ndb [2] https://cloud.google.com/datastore/docs/best-practices [3] https://cloud.google.com/datastore/docs/concepts/limits [4] https://googleapis.dev/python/python-ndb/latest/index.html On Saturday, February 29, 2020 at 7:14:04 AM UTC-5, Remko Tronçon wrote: > > Hi, > > We recently switched from the old App Engine Datastore DB API to the NDB > Cloud API. Since we did this, we are getting much more datastore contention > errors (which used to be a rarity). Is this expected? I was not expecting a > change of library to have any influence on behavior. > > thanks, > Remko > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/2731dede-319b-4fe9-af70-cfd80ad7a111%40googlegroups.com.