I’m trying to optimize code that reads objects from Google’s datastore. Using Java and JDO, here is my code:
List<Article> articles = (List<Article>) query.execute(articleId);
List<Article> detatchedArticles = (List<Article>) pm.detachCopyAll(articles);
When I look at the appstats logs, this results in:
datastore_v3.RunQuery 11ms (195ms api)
datastore_v3.Next 15ms (183ms api)
datastore_v3.Next 11ms (183ms api)
datastore_v3.Next 4ms (183ms api)
So, my question is; can I tweak somehow (JDO settings, other settings) how many objects that are fetched from the datastore per datastore_v2.Next?
I’m trying to win some API megacycles. Or, a lot, if what I want is possible.
If you are not already doing so, I would suggest using memcache. Depending on your entities, you could simply enable this in the jdoconfig.xml. Here’s a short howto: http://ukena.de/content/enabling-jdo-caching-google-app-engine. Note that if you are using embedded entities, you will have to handle memcache manually due to some bug in GAE’s JDO implementation.