如何避免 GAE datastore 的 race condition

答案在這篇 https://developers.google.com/appengine/docs/python/config/queue

裡面有一段

Configuring the Processing Rate

If you want to prevent too many tasks from running at once or to prevent datastore contention, you use max_concurrent_requests.


很明確指出, 如果要避免datastore 的爭奪(應是指race condition), 就要設定 queue 的max_concurrent_requests 參數, 讓同一時刻只有一個 task 會被執行
queue:- name: optimize-queue
  rate: 20/s
  bucket_size: 40
  max_concurrent_requests: 10

留言

熱門文章