The best way is to use a profile like YourKit that can give you the exact 
number. 


Without a profiler, you'd have to experiment. My guess is that you are less 
interested in absolute numbers (how big is my cache right now?), but rather in 
a correlation of max cache size vs. the amount of heap space your app requires 
(-Xmx).

There are 2 shared caches in Cayenne - object cache and query cache. Object 
cache size can be configured in the Modeler for a given DataDomain. Query cache 
size configuration depends on implementation (MapQueryCache, OSQueryCache, etc.)

So you have these 2 numbers to play with. You fill the caches to the maximum by 
doing some work in the app, and then check how much memory the entire app is 
using after repeated garbage collection cycles (e.g. via JConsole or VisualVM).

Andrus


On Feb 4, 2012, at 1:55 AM, Erlend Birkenes wrote:
> Hi
> 
> Is there a simple way to monitor or find out the memory usage of the shared
> cache at runtime?
> 
> 
> -Erlend

Reply via email to