0
votes

I have been trying to investigate what behaviours that may come from getting a DeadlineExceededException when using Objectify with caching turned on.

My experiments so far have been like this: 1) Store an entity or entities, 2) then sleep for most of the remaining execution time and 3) make some updates in an infite loop till the request is aborted. 4) Whether the cache is in sync with successful writes to the datastore is checked in a separate request.

"Some updates" means changing a lot (50) of strings in an object, then writing it back. I have also tried making updates to several objects in a transaction to test if I can get some inconsistent results when loading the entities again. So far, after thousands of tests, I have not got a single inconsistent entity from the cache.

So can I somehow provoke a load of a presumably cached entity to be inconsistent with the entity in the datastore?

1

1 Answers

0
votes

There are a lot of possible reasons for this. If you're making changes in a single request, you're probably seeing the session cache in operation:

https://github.com/objectify/objectify/wiki/Caching

If you're making queries in many requests, you may be seeing the results of eventual consistency:

https://cloud.google.com/datastore/docs/articles/balancing-strong-and-eventual-consistency-with-google-cloud-datastore/

Perhaps you are seeing session cache contamination because you don't have the ObjectifyFilter installed? Recent versions of Objectify give you a nasty warning if you don't, but maybe you're running an old version?