True, but there is also CPU overhead for the two rpcs. On Jan 5, 2012 6:02 PM, "Jason Collins" <[email protected]> wrote:
> There is still $$ difference. Memcache is (or appears to be) free, > datastore reads are not. > j > > On Jan 5, 8:01 am, Andrin von Rechenberg <[email protected]> wrote: > > Hey there > > > > For latency reasons we cache frequently fetched datastore entities: > http://code.google.com/appengine/articles/scaling/memcache.html#entit... > > > > *def getProfile(id):* > > * profile = memcache.get(id)* > > * if not profile:* > > * profile = datastore.get(id)* > > * memcache.put(profile)* > > * return profile* > > * > > * > > So we first check if we can get it from memcache, > > if not we get it from datastore and put it into memcache. > > Simple. In many cases the a profile is not in memcache, > > because we have a lot of profiles. So we do 3 RPCs. > > > > Looking a bit at appstats it seems that these days a > > datastore.get_by_key_name is as fast as a memcache.get > > in many cases, so I'm wondering if google has put a > > memcache infront of datastore and the pattern I'm doing > > above is obsolete and I could save the extra RPCs? > > > > Or maybe datastore is just having a good day? > > > > Cheers, > > -Andrin > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
