Saturday, 15 September 2012

google app engine - Making db.put() failsafe -


I do a DB.PUT operation to try to maximize as much flexibility as possible in my Google App Engine service Would like to Probability of success in case of infrastructure issues or overload What I have come up with at the time, to try to catch every possible exception and to create a task that retries the commitment if the first attempt fails:

  try: db Put (new_user_record): Excluding Deadline Expected Error: Excluding deferred.defer (db.put, new_user_record): deferred.defer (db.put, new_user_record)   

Is this code all possible Runs the error path? Or else in other ways can DB.Put () fail, which is not caught by this code?


Edit on March 28, 2013 - Explain when failure is expected

It seems that the answer is still to believe that if db.put ( ) Fails because it is because the datastore is below it is not necessary to run a very high workload in your experience. Sometimes you participate in workload-specific API barriers, sometimes requesting an API slow request The deadline ends in another. Although there is a low frequency in such incidents, if the traffic is more then their number may be higher. These are the conditions that I am trying to cover.

I would not say that this is the best way - whatever happened, the original exception again Are likely to be What I will do for the extra flexibility I can load the record for the first time in Memchet and in the event of an exception (any exception) it attempts a certain number (for example 3) a small sleep between each With effort Depending on your application, it may either have a synchronous operation or use deferred functions which it can use data in the asynchronous memcache.
In the end I actually do a query on the record in the data store, even if there is not one line to really confirm it has been written.

No comments:

Post a Comment