Hi, I have an app which has enabled billing. Totally I'm far from exceeding my qouta but in the logs I see on many requests the following: "this resource used a high amount of CPU and may soon exceed it's qouta". It seems like these requests use about 1000cpu_ms. How much is allowed for one requests? I read something about per- minute qouta...
The handler of this type of requests just acts like a proxy server to a rest api: -------------------------------------------------------------------------------------------------------------------------- import cgi import urllib import wsgiref.handlers import datetime from google.appengine.ext import webapp from google.appengine.api import urlfetch from google.appengine.api import memcache class YrController(webapp.RequestHandler): def get(self): self.response.headers['Content-Type'] = "text/xml" self.response.headers['Cache-Control'] = "public, max-age=3600" endpoint = 'http://api.yr.no/weatherapi/locationforecast/1.6/' params = self.request.GET apiquery = urllib.urlencode(params) weather = memcache.get(apiquery) lastmod = memcache.get(apiquery + "Last-Modified") expires = memcache.get(apiquery + "Expires") if lastmod is None: lastmod = datetime.datetime.today().replace(microsecond=0) if expires is None: expires = lastmod + datetime.timedelta(hours=1) if self.request.headers.has_key("If-Modified-Since"): dt = self.request.headers.get("If-Modified-Since") modsince = datetime.datetime.strptime(dt, "%a, %d %b %Y %H:%M:%S GMT") if modsince >= lastmod: self.error(304) return if weather is None: result = urlfetch.fetch(url=endpoint + '?' + apiquery, method=urlfetch.GET) weather = result.content memcache.set(key=apiquery, value=result.content, time=3600) memcache.set(key=apiquery + "Last-Modified", value=lastmod, time=3600) memcache.set(key=apiquery + "Expires", value=expires, time=3600) self.response.headers['Last-Modified'] = lastmod.strftime("%a, %d %b %Y %H:%M:%S GMT") self.response.headers['Expires'] = expires.strftime("%a, %d %b %Y %H: %M:%S GMT") self.response.out.write(weather) def main(): application = webapp.WSGIApplication([('/api/', YrController)], debug=True) wsgiref.handlers.CGIHandler().run(application) if __name__ == "__main__": main() -------------------------------------------------------------------------------------------------------------------------- Is it because the requests can take some time to excecute (waiting for the the urlfetch request) it takes alot of cpu_ms? How can I improve the performance of this? Magnus -- 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-appeng...@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.