Re: [google-appengine] 6470ms for a memcache get and write out the result?
you are right and i will do it but this is not what is causing that huge delay in the response. On Oct 15, 2011, at 6:01 AM, djidjadji wrote: >>page = CachedObject.all(keys_only=True).filter('appversion =', >> appversion) \ >> .filter('uri =', uri).get() >>if page: >>p = db.get(str(page)) >>self.write(p.html) >>memcache.set(cachekey, p.html, >> namespace='cachedpage|%s'%appversion) >>return >>else: > > Why do you first check to see if the datastore object exist > (keys_only=True) and then fetch if key is found. This adds an extra > RPC roundtrip. > Just fetch the object and test page for None > >page = CachedObject.all().filter('appversion =', appversion) \ > .filter('uri =', uri).get() >if page: >self.write(p.html) >memcache.set(cachekey, p.html, > namespace='cachedpage|%s'%appversion) >return >else: > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to google-appengine@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine+unsubscr...@googlegroups.com. > 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 google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
Re: [google-appengine] 6470ms for a memcache get and write out the result?
> page = CachedObject.all(keys_only=True).filter('appversion =', > appversion) \ > .filter('uri =', uri).get() > if page: > p = db.get(str(page)) > self.write(p.html) > memcache.set(cachekey, p.html, > namespace='cachedpage|%s'%appversion) > return > else: Why do you first check to see if the datastore object exist (keys_only=True) and then fetch if key is found. This adds an extra RPC roundtrip. Just fetch the object and test page for None page = CachedObject.all().filter('appversion =', appversion) \ .filter('uri =', uri).get() if page: self.write(p.html) memcache.set(cachekey, p.html, namespace='cachedpage|%s'%appversion) return else: -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] 6470ms for a memcache get and write out the result?
hi, im having serious speed issues on a site. my app is a python app and im using torndadoweb to serve requests. the actual rendered html is also store in the datastore and memcache. a decorator on the GET request checks first if there is a memcache entry if it exists it writes the html out, if there is no memcache entry it tries to get it from the datastore and only if that doesnt exist too it executes the handler. what i noticed is that the simple get from the memcache until the page displays on the browser takes way too long and i actually dont understand how this is possible. here is my stats result: what is actually taking 6seconds here my decorator looks like this: def cache_page(with_keywords=False, keywords=None): def decorator(method): def wrapper(self, *args, **kwargs): uri = self.request.uri.strip() cachekey = '%s|%s' %(appversion, uri) cached = memcache.get(cachekey, namespace='cachedpage|%s'%appversion) if cached: self.write(cached) return page = CachedObject.all(keys_only=True).filter('appversion =', appversion) \ .filter('uri =', uri).get() if page: p = db.get(str(page)) self.write(p.html) memcache.set(cachekey, p.html, namespace='cachedpage|%s'%appversion) return else: ... return method(self, *args, **kwargs) return wrapper return decorator this shouldnt take that long right? any thoughts? thank you<>-- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.