I'm obsessed with reducing the RPC waves, for example, instead of fetching 
N things sequentially, I try to minimize the batch to 1, fetch them with N 
async requests, or 2, fetch K<N, then fetch the rest later, if there are 
dependency issues

Fetching everything in async is not possible, for example if you are 
fetching an element and it's owner, you have to fetch the element first, 
learn the owner, fetch the element later, which increases the wave of RPC's 
to 2
(This is a backstory, simplified to emphasize my point, what I do differs 
from simply fetching an owner, also I don't use the ElementProperty's and 
stuff like that, I keep the id's as StringProperty's for simplicity)

Owner.get_by_id_async(possible_owner_id)
element=Element.get_by_id(id)
owner=Owner.get_by_id(element.owner)

possible_owner_id == element.owner (unless it's forged, if it's forged, the 
second call gets the actual owner)

Would the initial call Owner.get_by_id_async(possible_owner_id) get the 
owner of the element cached and reduce the RPC delay from 2 to 1?

Things are not always as simple as this, sometimes you can guess what needs 
to be used inside a function, so triggering a get_async could increase the 
performance significantly and simplify things a lot, however I'm unsure 
whether not getting the item, just triggering it asyncly is enough

Does ndb detect that async operation and simply wait for the result instead 
of re-fetching it?

(I guess /_ah/stats can answer this, however I haven't discovered how to 
interpret those stats yet, the stats also glitch in production, the page 
overloads the app)

I guess I can test this myself too, measuring the delays and comparing the 
fetched entities, I will update the discussion if I get concrete results

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.

Reply via email to