I am using guava's cache on server side of my gwt-webapp. But to configure the cache properly i need to know some "telemetry". First I need to know how much memory one cache entry takes. So far i tried jconsole and visualvm. The problem is, I don't know where to look at. I looked for ConcurrencyHashMap and its entries, but can't find the correct number of instances.
So what is a good and probably easy way to profile a (guava) cache?
(at the moment i am not ready to pay for a tool to just get an approximation/average of size of cach (entry))
summarization of state of discussion: Aaron Digulla suggest to use weak references and let Java do the Job of managing memory. But in an previous question the people suggest to "tune, monitor, tune" the cache because of performance issues on using weak references.
update ok my question was probably misguiding - i don't want to know something about the cache or its overhead. i want to know how big is an instance of a given object - to configure a cache (in this case guava). the first question i must answer is: Could i get all instances in memory (100% hit rate) or how much memory this will take. If this is possible no cache configuration is necessary. if all object will take too much memory i must think about configuration. My hope is there is a tool that could say something about an average memory footprint of objects.