Hi Jason,

Thanks for your reply.
Following is my PersistenceCapable Person class (root):

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Person {

        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        public Key key;
        @Persistent
        public String fName = "";
        @Persistent
        public String mName = "";
        @Persistent
        public String lName = "";
        @Persistent
        public String fullName = "";
        @Persistent
        public BlogPosts blogP;

        //Methods
}

________________________________

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class BlogPosts{
        @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        public Key key;
        @Persistent
        ArrayList<BlogPost> blogPosts;
        @Persistent
        Date lastUpdated;
}
______________________________________

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class BlogPost{

        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        public Key key;
        @Persistent
        public long id;
        @Persistent
        public String title;
        @Persistent
        public String description;
        @Persistent
        public String source;
        @Persistent
        public String sourceLink;
        @Persistent
        public Date date;
        @Persistent
        public String url;
        @Persistent
        public boolean show = true;
}
______________________________________

My application ID : celeblogin

As you can see from the classes the Person class owns one BlogPosts
class,
which in turn owns around 20 BlogPost objects in an ArrayList.
(Note: all properties are small strings & all persistent classes are
in same entity group)

I am under the impression that, when I query a Person object from the
datastore, the
data for blogP property will only be retrieved if accessed. Is that
correct? If not, then that might
explain the high datastore CPU usage. (One more thing I noticed is
that, most of the CPU utilization in
my quota comes from the datastore CPU usage.)

All that my JSP page is doing is displaying the fullName field of all
<Person> entities. There is no write operation.

Just to see how my application in its currents form, would scale. I
increased the number of person entries from 43 to around 300. And
things went from bad to worse.

09-24 09:26AM 58.766 / 200 6971ms 10888cpu_ms 9177api_cpu_ms 5kb
09-24 09:26AM 30.488 / 200 9191ms 11238cpu_ms 9177api_cpu_ms 5kb
09-24 09:25AM 57.039 / 200 6986ms 11355cpu_ms 9177api_cpu_ms 5kb
09-24 09:25AM 18.872 / 200 8165ms 11919cpu_ms 9177api_cpu_ms 5kb

for around 100 entries :

09-23 07:51PM 03.976 / 200 4368ms 6138cpu_ms 5146api_cpu_ms 2kb
09-23 07:47PM 34.263 / 200 3669ms 5338cpu_ms 4366api_cpu_ms 2kb
09-23 07:44PM 33.428 / 200 8954ms 14485cpu_ms 4413api_cpu_ms 2kb
09-23 11:14AM 54.938 / 200 4554ms 5574cpu_ms 4330api_cpu_ms 2kb
09-23 11:13AM 53.272 / 200 10302ms 14447cpu_ms 4395api_cpu_ms 2kb


Isn't JDO implementation in gae designed to use memchache by default?
I see few
calls made to memchache api on the quota details page for each
request.

I'll try using key only queries and low level apis to see if I get any
improvement, but wouldn't
that just complicate the code? Since the Person is a root entity, I'll
have to make special provisions to store the keys, then read all the
keys and use those keys to read the names from Person class.

Also, I wanted to ask, will it make any significant difference if I
use JPA instead of JDO?








On Sep 23, 2:57 am, "Jason (Google)" <[email protected]> wrote:
> When you have a chance, please post your JDO/JPA class. I'm especially
> interested to know whether you're using any large BLOB or Text properties,
> and if so, the size of the data that you're storing in these. Also, it would
> help to know what results you see when you a) use a keys-only query and b)
> use the low-level datastore API instead of JDO/JPA.
> - Jason
>
>
>
> On Mon, Sep 21, 2009 at 2:03 PM, Jason (Google) <[email protected]> wrote:
> > 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 <[email protected]> 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 [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-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to