Are you seeing these response times on subsequent refreshes? I assume so
given the timestamps. What is your application ID?
One idea that would certainly help is using memcache to avoid querying on
every request, but I'll follow up on why you're seeing these response times
with the query. Are you doing anything else in your JSP besides displaying
these names?

- Jason

On Sun, Sep 20, 2009 at 1:50 AM, Gaurav <ano...@gmail.com> wrote:

>
> The JSP page I created is using too much of CPU and showing high
> latency.
>
> The page lists all the entities of type Person.class. (At present
> there are 43 entities in the datastore.)
> (Person is a root entity)
>
> Following is the method to return the list of all Person objects in
> the datastore :-
>
> public class ListPersons {
>
>        public static List<Person> allPersons(){
>
>                PersistenceManager pm = PMF.get().getPersistenceManager();
>                Query query = pm.newQuery(Person.class);
>                List<Person> results = (List<Person>) query.execute();
>                return results;
>        }
> }
>
>
> The JSP page code :
>
> <%
>        List<Person> peopleList = ListPersons.allPersons();
>        Iterator<Person> iter = peopleList.iterator();
>        while(iter.hasNext()){
>                Person p = (Person) iter.next();
>                out.print("<br/>"+p.getFullName());
>        }
>
> %>
>
>
> Request logs for this page:
>
> 09-20 01:29AM 35.604 / 200 848ms 1383cpu_ms 1072api_cpu_ms 1kb
> 09-20 01:29AM 33.286 / 200 850ms 1344cpu_ms 1072api_cpu_ms 1kb
> 09-20 01:29AM 29.196 / 200 807ms 1383cpu_ms 1072api_cpu_ms 1kb
> 09-20 01:29AM 24.946 / 200 792ms 1364cpu_ms 1072api_cpu_ms 1kb
> 09-20 01:29AM 20.197 / 200 839ms 1383cpu_ms 1072api_cpu_ms 1kb
> 09-20 01:26AM 55.564 / 200 779ms 1364cpu_ms 1072api_cpu_ms 1kb
> 09-20 01:26AM 38.545 / 200 737ms 1344cpu_ms 1072api_cpu_ms 1kb
> 09-20 01:26AM 36.355 / 200 869ms 1325cpu_ms 1072api_cpu_ms 1kb
> 09-20 01:26AM 34.205 / 200 817ms 1402cpu_ms 1072api_cpu_ms 1kb
> 09-20 01:26AM 32.245 / 200 782ms 1364cpu_ms 1072api_cpu_ms 1kb
>
> Clearly I am doing something wrong. I just don't know what it is.
> The page is displaying the results correctly. It's just taking too
> long.
>
> How can I optimize it? Need help.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to