I've been trying to track down why I'm seeing huge latencies in one of
my apps. I tracked it down to a large (~100 entity) batch get call. My
understanding was the batch get should be comparable to a query, which
is seems confirmed here

http://groups.google.com/group/google-appengine/browse_thread/thread/84ef15d24d3749fb/7ea0a5a22ef4b316

In my testing batch gets are about twice as long as a simple query.
With Appstats turned on it's taking 8x!

Query Fetch ~500ms (w/o appstats) ~500ms (w appstats)
Batch Get    ~1000ms (w/o appstats) ~4000ms (w appstats)

Does this seem about correct? My impression leaving appstats in the
production version was minimal overhead. I've included a simple
version below. This is python 2.7 and HR datastore btw.

from google.appengine.ext import db
import webapp2 as webapp

import time

class UserAccount(db.Model):
    name = db.StringProperty(indexed=False)


class MakeDataHandler(webapp.RequestHandler):
    def get(self):
        db.put([UserAccount(key_name='TST'+str(i), name="Testing") for
i in range(100)])

class TestSpeedHandler2(webapp.RequestHandler):
    def get(self):
        start_time = time.time()

        db.get([db.Key().from_path("UserAccount",str(f)) for f in
range(100)])

        self.response.write(str(int((time.time() - start_time)*1000)))


class TestSpeedHandler3(webapp.RequestHandler):
    def get(self):
        start_time = time.time()

        db.Query(UserAccount).fetch(100)

        self.response.write(str(int((time.time() - start_time)*1000)))


application = webapp.WSGIApplication([(r'/makedata',MakeDataHandler),
                                      (r'/
testspeed2',TestSpeedHandler2),
                                      (r'/
testspeed3',TestSpeedHandler3)],
                                      debug=False)

-- 
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.

Reply via email to