Ari,

thanks for the YourKit suggestion.

Also, consider a common approach is to have one 'read-only' [1] shared context which persists for the life of the application and is used to show data (products, etc) to users. Then a small context created per session which contains just the objects which that user is modifying (invoice, invoice lines, payment, contact, etc) within the session. Certainly that isn't the only approach, but it is pretty common.

That is pretty much what I was wanting to do (after listening to all the input). However, I am not sure how to implement this design in a webapp with session and a Cayenne filter that is creating the DataContext for me (automagically as they say).

I suspect if I implement this sort of simple design (as about 95% of the result sets will be "read-only"), I could probably manage the memory much better.

So how do I create a shared context? Is this going to be associated with an Application scoped singleton? Also how do I create the smaller contexts and make sure they are GC'd after the session is terminated?

Thanks for the input,
Joe




On Sep 17, 2009, at 11:53 PM, Aristedes Maniatis wrote:

To remove some of the black magic can I suggest a tool like YourKit? It is very helpful for figuring out where all your memory goes.

Also, consider a common approach is to have one 'read-only' [1] shared context which persists for the life of the application and is used to show data (products, etc) to users. Then a small context created per session which contains just the objects which that user is modifying (invoice, invoice lines, payment, contact, etc) within the session. Certainly that isn't the only approach, but it is pretty common.

Ari Maniatis


[1] There is no such thing as a 'read-only' context in Cayenne. Read- only just describes the way you use it.



On 18/09/09 4:53 AM, Michael Gentry wrote:
That's probably bigger than you want.  Try 500 just to see how it
works.  Adjusting that number is black magic.  :-)


On Thu, Sep 17, 2009 at 2:40 PM, Joe Baldwin<[email protected]> wrote:
Michael

What is the size of your object cache? Look under the DataDomain. If
it is a large number, try lowering it.


Query Cache Factory: org.apache.cayenne.cache.MapQueryCacheFactory
Size of Object Cache: 10000
Use Shared Cache: checked

I do not know if 10,000 is small, medium, or large.

What do you recommend?

Joe



--

-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Reply via email to