Hi!,

I feel it's slow in both the development environment and live. I have
run some profiling on the site with firebug and I can see that the
"waiting for response" part on all request to script handlers is about
800ms. This seems like a very long time. The site I have developed is
a weather service and I fetcht the weather data using ajax requests. I
takes a few requests to load all the weather.

In a test it took 24 requests to load all the weatherdata and the load
time for this was 13.24 seconds. This is a long time to fetch these
request. About 99% of this time is "waiting for response". I'm using
memcached to cache the response using this code:

import cgi
import urllib
import wsgiref.handlers
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'] = "application/xml"

                endpoint = 'http://api.yr.no/weatherapi/locationforecast/1.6/'

                params = self.request.GET
                apiquery = urllib.urlencode(params)

                weather = memcache.get(apiquery)

                if weather is not None:
                        self.response.out.write(weather)
                        return
                else:

                        result = urlfetch.fetch(url=endpoint + '?' + apiquery,
method=urlfetch.GET)
                        memcache.add(key=apiquery, value=result.content, 
time=3600)
                        self.response.out.write(result.content)

def main():
        application = webapp.WSGIApplication([('/api/',
YrController)],debug=True)
        wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
        main()



This handler works like a proxy server against a xml api. I can
understand that it takes some time to load when the data is fetched
from the api but once the data is in memcached it should not take
800ms for the server to handle the response. This webbapp used to be
written in ASP .NET also using memcached and there the average
"waiting for response" time for a request is about 100ms.

I will run some profiling on the handler and see what it is that takes
time. Or could anyone else se what it is? Anyway I could optimize this
for shorter load times?

//Magnus

On Nov 24, 12:45 am, "Ikai L (Google)" <ika...@google.com> wrote:
> What part of this application is slow? Is it just slow in development mode?
> The link you sent out seems to load reasonably fast.
>
> What may be happening is that your application may be cycling out. We do
> this to dynamically adjust the number of instances to match the level of
> load your application is experiencing. If your application is cycled out,
> when a request comes in, we cycle it back in, but to do this, we need to
> load your environment and fire up an application instance.
>
> On Sat, Nov 21, 2009 at 7:29 AM, Magnus O. <
>
>
>
>
>
> magnus.ottos...@magnusottosson.se> wrote:
> > Hi,
>
> > I just started developing with python and google app engine and my
> > first project is to build a small easy proxy server to enable cross
> > domain xml requests from the client. I'm experiencing logn response
> > times in all python handlers. Static files as being served fast but
> > python handlers are loading slow 800ms - 1.5 seconds. For instance,
> > here is my default page that (for now) just loads an index.html static
> > file as template:
>
> > import cgi
> > import urllib
> > import os
> > import wsgiref.handlers
> > from google.appengine.ext import webapp
> > from google.appengine.api import urlfetch
> > from google.appengine.ext.webapp import template
>
> > class MainController(webapp.RequestHandler):
>
> >        def get(self):
>
> >                template_values = {}
>
> >                path = os.path.join(os.path.dirname(__file__), 'index.html')
> >                self.response.out.write(template.render(path,
> > template_values))
>
> > def main():
> >        application = webapp.WSGIApplication([('/',
> > MainController)],debug=True)
> >        wsgiref.handlers.CGIHandler().run(application)
>
> > if __name__ == "__main__":
> >        main()
>
> > Anyone that can tell me why the load times are so slow? You can see it
> > in action here:http://blirdetsol.appspot.com/
>
> > --
>
> > 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<google-appengine%2Bunsubscrib 
> > e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine

--

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.


Reply via email to