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.

  1. Load your heap dump into Eclipse MemoryAnalyzer in the usual way.
  2. View the histogram
  3. Type "net.sf.ehcache.Cache" in the filter
  4. List outgoing references for the object
  5. Check out all of your caches!
  6. 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

  1. Open a command prompt
  2. Navigate to <JDK Home>/bin
  3. 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

  1. Navigate to <JDK Home>/bin
  2. Run jconsole.exe
  3. Connect to the Tomcat process
  4. Go the "MBeans" tab
  5. Go to com.sun.management->HotSpotDiagnostic->Operations
  6. p0 is the path where the heap dump will be saved
  • No labels