Analyzing EhCache Memory Usage
Using Eclipse Memory Analyzer
In lieu of using EhCache Monitor (http://ehcache.org/documentation/operations/monitor) one can still do analysis of the EhCache's memory footprint via heap dump analysis.
- Load your heap dump into Eclipse MemoryAnalyzer in the usual way.
- View the histogram
- Type "net.sf.ehcache.Cache" in the filter
- List outgoing references for the object
- Check out all of your caches!
- For each cache, you can see the name of it by going to net.sf.ehcache.Cache -> configuration -> name
Generating Heap Dumps for Tomcat running in Eclipse
Note: there are a couple of ways to grab a heap dump of Shindig while it's running from Tomcat in Eclipse.
Use JMap
- Open a command prompt
- Navigate to <JDK Home>/bin
- Execute jmap -dump:format=b,file=c:\heap.hprof <pid>
Note: I find the <pid> by using Process Explorer and looking at the VM args.
Use the HotSpotDiagnostic MBean
- Navigate to <JDK Home>/bin
- Run jconsole.exe
- Connect to the Tomcat process
- Go the "MBeans" tab
- Go to com.sun.management->HotSpotDiagnostic->Operations
- p0 is the path where the heap dump will be saved