Hi Joe, Assuming 2000 products fetched with a paginated query and a page size of 50, I believe the answers are ...
Q1: 2000 hollow objects are created. Cayenne fetches the primary keys of the objects first in a paginated query. Q2: Whichever page (or pages) you access in the paginated list will fault those objects for that page (grouped by 50 at a time) into memory. Q3: If you try to filter or sort in-memory, then it will have to fetch all of the objects. Might be better to re-issue a query to the DB. Q4: If your list pointers go out-of-scope, but the DataContext is still in-scope, then the objects will still be in the DataContext until you evict them. mrg On Thu, Apr 8, 2010 at 4:24 PM, Joe Baldwin <[email protected]> wrote: > Andrus, > > In this same context, I have a question about what behavior I should expect > to see. > > Let us assume for this scenario: > 1. a web deployment with Tomcat, typical webstore pattern > 2. 2000-5000 products with an attribute "name" > 3. custom search engine built on top of cayenne > a. mostly standard configuration > b. set PageSize to 50 > c. using (presumably) default caching > d. custom factory class method used to create a select query > 4. a user searches for "guitar" substring in the name field > > Questions: > 1. Based on my tests, it appears that "hollow" objects are created but no > faults are fired. (true?) > 2. If I display any product data for a subset less than PageSize, then only > <PageSize> number of objects are faulted (true ?) > 3. If I execute "filterObjects" or "orderList" on the resulting list, I > assume the fault is fired for all objects in the list. (true ?) > 4. What normally happens to these objects if my list pointers go out of > scope? (Are they GarbageCollected per Java rules?) > > (Note: I have not been able to get much visibility in understanding (3) & > (4), but I think my tests show that 1 & 2 are correct.) > Joe > > > > > On Apr 8, 2010, at 12:42 PM, Andrus Adamchik wrote: > >> BTW, we started on some monitoring hooks inside Cayenne runtime in 3.0 per >> http://issues.apache.org/jira/browse/CAY-1173 , however then it was decided >> that it'll work much better with the 3.1 DI-based stack. So this is waiting >> for its time. >> >> Andrus >> >> >> On Apr 7, 2010, at 6:16 PM, Joe Baldwin wrote: >> >>> I am attempting to do more performance monitoring (with an eye towards >>> optimizing my design & use of DataObject lists and lifetime). >>> >>> The first thing I would like to do is monitor how many DataObjects are >>> created and which JSP session they belong. >>> >>> My idea was to simply create a constructor for the DataObject of interest >>> and place monitoring hooks inside. I would assume that I could also create >>> a finalize method to do similar things. >>> >>> Is this the best way to create custom monitoring using Cayenne DataObjects >>> or is there a better way? >>> >>> (BTW, even after reading the docs, I am still somewhat mystified by how my >>> configuration specifications control the life cycle and performance. So I >>> am hoping these custom hooks will make my design decisions more visible, >>> especially with multiple users.) >>> >>> Thanks, >>> Joe >>> >>> >> > >
