Use a single batch get() instead of issuing lots of separate queries.
It is best to think of the datastore as a big distributed hashmap
rather than an RDBMS.

Batch gets are easy to do with Objectify (a JDO alternative for GAE).
You can still do batch gets with JDO but the syntax is tortured.  It
looks something like this:

Query q = pm.newQuery("select from " + Book.class.getName() + " where
:keys.contains(key));

Jeff

On Sat, Apr 17, 2010 at 9:22 PM, Martin de la torre <[email protected]> wrote:
> Hello i am doing a jsp where i make one call to facebook to get the  logged
> client , another to get their friends and
> and for each friend i look him on the datastore  .Finaly i show on html the
> raking of the friends.
>
> for (int i=0;i<friends.length();i++)
>      {
>           String amigo=friends.getString(i);
>           String query = "select from " + Jugador.class.getName()+" where id
> == "+amigo;
>           List<Jugador> jugadores = (List<Jugador>)
> pm.newQuery(query).execute();
>           if(!jugadores.isEmpty())
>           jugadoresAmigos.add(jugadores.get(0));
>      }
>
> It seems that  this process is very time consuming and sometimes the jsp
> does not load because it exeds the 30 seconds limit.
> is there a way to optimize it?
>
> here i read that it is good to have a lot of small requests but i did not
> figure how can i do that
> http://wubbahed.com/2009/03/01/google-appengine-and-facebook-applications-10-things-i-wish-i-had-known/
>
> thanks
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to