JVM HEAPDUMP & JAVACORE 옵션 설정

JVM HEAPDUMP & JAVACORE 옵션 설정

Application servers > Application_server > Process Definition > Custom Properties 
Application servers > Server Name > Process definition > Java Virtual Machine > Custom properties

Name Value

IBM_HEAPDUMP true  &  false
IBM_HEAPDUMPDIR /apps/logs
IBM_HEAPDUMP_OUTOFMEMORY true  &  false
IBM_HEAP_DUMP true  &  false

IBM_JAVACOREDIR /apps/logs
IBM_JAVADUMP_OUTOFMEMORY true  &  false
IBM_JAVA_HEAPDUMP_TEXT true  &  false
JAVA_DUMP_OPTS ONANYSIGNAL(JAVADUMP[5],HEAPDUMP[5])


Out Of Memory Error 발생시 Dump 생성 위치 변경하기

[출처] [WebSphere] Out Of Memory Error 발생시 Dump 생성 위치 변경하기|작성자 jaejeongk
IBM JDK 를 사용하는 환경에서 Out Of Memory Error가 발생하는 경우 WebSphere Application Server는 아래 위치에 javacore와 heapdump를 생성한다.
For WebSphere Application Server V6.0, V6.1, and V7.0:
        AIX or Linux: profile_root/logs/server_name
        Windows: profile_root\logs\server_name

For WebSphere Application Server V5.1:
        AIX or Linux: install_root/logs/server_name
        Windows: install_root\logs\server_name


MustGather: Out of Memory errors with WebSphere Application Server on AIX, Linux, or Windows
filesystem 관리 등의 이유로 생성 위치를 변경하고 싶다면 아래와 같이 환경 설정에 아래와 유사하게 설정한다면 생성 위치를 변경할 수 있다.
    IBM_COREDIR
        AIX or Linux: /waslog
        Windows: D:\waslogs

    IBM_HEAPDUMPDIR
        AIX or Linux: /waslog
        Windows: D:\waslogs

    IBM_JAVACOREDIR
        AIX or Linux: /waslog
        Windows: D:\waslogs


참고 사이트
http://www.ibm.com/developerworks/aix/library/au-javaonaix_memory.html
Setting up the environment
To properly set up the environment that you'll need:
  1. Set the user process limits to unlimited by running the following command as the root user:
    chuser fsize=-1 data=-1 core=-1 user_id_running_application

    where user_id_running_application is the name of the user running the Java application. For example, chuser fsize=-1 data=-1 core=-1 stack=-1 root
    This will change the file size (fsize), core file size (core), memory size (data), and stack (stack) of the user to unlimited. Be aware that there can be risks associated when using these settings, so once information has been collected, the original settings should be re-enabled. Once the changes have been made, remove references to the ulimit command in login or user profiles, or any startup scripts. You must re-login as the user prior to starting the application. Also, any application started from the /etc/inittab file may require a system reboot, because the changes might need a chance to affect the init process. Be aware that making these changes does allow the user for which the changes were made to potentially run a process that could consume system resources.
    Verify the change by running the following command prior to starting the Java application:
    ulimit -a
  2. Separate the Java heap from the native heap. Using the information in High-level overview, determine if the Java heap is malloc'ed or mmap'ed. If the Java heap is malloc'ed, then set the following environment variables to force the Java heap to be mmap'ed. For the LDR_CNTRL=MAXDATA setting, replace N with the number of segments to be used for the native heap. A good estimation is to divide the maximum size of the Java heap by 256MB and round up to the nearest whole number, then subtract that number from 8.
    For example, if -Xmx is set to 512 MB, then the value of N would be: 8 - 512MB/256MB = 8 - 2 = 6.
    export IBM_JAVA_MMAP_JAVA_HEAP=true
    export LDR_CNTRL=MAXDATA=0xN0000000
  3. Set the Java environment variables for generating heap dumps. The following environment variables will allow the JVM to generate a list of all the objects in the Java heap. This feature is specific to the IBM JVM.
    export IBM_HEAP_DUMP=true
    export IBM_HEAPDUMP=true
    export IBM_HEAPDUMP_OUTOFMEMORY=true
    export IBM_JAVACORE_OUTOFMEMORY=true

    The dump file generated can be post-processed using the HeapRoots tool, available at no cost at IBM AlphaWorks.
    Starting with SDK 131 SR6, 141 SR2 and 142, these variables will automatically be set by the JVM, which can result in several heap dump files (heapdump##.txt) and Javacore files (javacore##.txt) being generated when the Java heap becomes exhausted. This can be disabled by setting the environment variables:
    export IBM_HEAPDUMP_OUTOFMEMORY=false
    export IBM_JAVACORE_OUTOFMEMORY=false

    Starting with Java 14, IBM has implemented a heap dump format that differs from the previously generated text based heap dumps. This new heap dump format can be identified by the phd file extensions instead of the txt file extension. So that the HeapRoots tool, available for free on IBM's AlphaWorks download site, can be used to analyze these files, it is important that the following environment variable always be set when troubleshooting java heap memory issues:
    export  IBM_JAVA_HEAPDUMP_TEXT=true
  4. Generate GC output. When starting the Java process, include the command line option:
     -verbose:gc

    prior to any command line parameters. Also, the standard error from the process needs to be redirected into a file. For example, for a standalone Java process, you would run something similar to:
     java -verbose:gc ... 2> java.err

    For some application environments, the standard error may automatically be saved to log files for that environment. Just make sure this is enabled.











0 Comments:

댓글 쓰기

이 블로그 검색

Popular Posts

WEB&&WAS

OS

Reviews