Search code examples
websphere-8heap-dump

heap dump generation on websphere


I have enabled automatic heap dump generation on Websphere application server 8.5.5 by below steps.

Appserver>>process definition>>environment entries

Added below 2 entries.

IBM_HEAPDUMP = TRUE
IBM_HEAPDUMP_OUTOFMEMORY = TRUE

I just want to know how frequently heap dump will be generated? example out of 15 request. 10 request, we have faced outofMemoryerror: java heap space. Heap dump will generate for 1 time or 10 times?


Solution

  • There is no such feature using environment variables.

    The IBM_HEAPDUMP is only useful to set to false to completely disable heapdumps. Setting it to true is redundant because that is the default.

    The same is true of IBM_HEAPDUMP_OUTOFMEMORY. Taking a heapdump on an OutOfMemoryError is enabled by default.

    You can find more information on these environment variables here: https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.vm.80.doc/docs/env_j9.html

    Note that envars to control dumps are no longer recommended in favor of -Xdump: https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.vm.80.doc/docs/dump_agents.html

    With that said, there is no such feature as automatically generating heapdumps without some trigger. You can find various way on how to request heapdumps here: https://publib.boulder.ibm.com/httpserv/cookbook/Troubleshooting-Troubleshooting_WebSphere_Application_Server-Troubleshooting_WAS_Traditional.html#Troubleshooting-Troubleshooting_WAS_Traditional-Request_Heap_Dump

    The easiest way is probably to script it. You haven't specified which operating system you're on, but I'll guess it's POSIX-based with IBM Java, so I would use Java Surgery with a shell script:

    #!/bin/sh
    while true; do
      java -jar surgery.jar -command HeapDump -pid $1
      sleep $2
    done
    

    https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=7d3dc078-131f-404c-8b4d-68b3b9ddd07a