Enhancing Java memory management: java.lang.OutOfMemoryError

Article:TECH108440  |  Created: 2002-01-12  |  Updated: 2007-01-19  |  Article URL http://www.symantec.com/docs/TECH108440
Article Type
Technical Solution

Issue



The database server (Java.exe) memory usage increases up to about 80 MB, and the server slows down considerably. Command Center slows down when executing group operations or the DesktopAgent Support service does not react as expected.

The CCM Desktop Agent Support Service or the CCM Database service logs:

2002-10-30 14:43:03 [10960:45FC] L1 [3015]: JDBGetComputer: Java error occurred attempting to find computer "rdskd03v":
com.on.ccm.dbserver.api.CcmCommException: Error occurred in server thread;
nested exception is:
java.lang.OutOfMemoryError

Or: Error unmarshaling return header ... java.io.EOFException


Solution



    Increase the maximum heap size of the JVM, which defaults to 64 MB. You may fine tune three separate instances of a CCM server.

    To fine-tune the CCM database server
    1. Open a DOS shell on the CCM server.
    2. Type the following:

      cd /d %SME_ROOT%\services\ccmdb
    3. Stop the database service by typing one of the following:

      net stop ccmdb
      or
      ccm stop
    4. Type the following:

      ccmdb -s unbind

      This creates Ccmshell.exe and Ccmdb.ini.
    5. In Ccmdb.ini, add the -Xmx command-line flag, which sets the maximum heap size.
      For example, to set the maximum heap size to 200 MB, type the following in the [application] section:

      [application]
      ExecPath=%SME_ROOT%\java\jre1.3\bin\java -Xmx200M -Xrs -cp %DB_CLASSPATH% com.on.ccm.dbserver.DbServer
    6. Type the following:

      ccmshell -f ccmdb.ini -s bind ccmdb.exe
    7. Start the database service and its dependent services by typing the following:

      ccm start
    8. Watch the Java.exe memory.
      In case of high load, it should now exceed 80 MB, if required.

    To fine-tune the RMI server
    1. Open a DOS shell on the CCM server.
    2. Type the following:

      cd /d %SME_ROOT%\services\rmiregistry
    3. Stop the RMI service by typing one of the following:

      net stop ccmrmi
      or
      ccm stop
    4. Type the following:

      ccmrmi -s unbind

      This creates Ccmshell.exe and Ccmrmi.ini.
    5. In Ccmrmi.ini, add the -Xmx command line flag, which sets the maximum heap size.
      For example, to set the maximum heap size to 200 MB, type the following in the [application] section:

      [application]
      ExecPath=%SME_ROOT%\java\jre1.3\bin\java -Xmx200M -Xrs -cp %DB_CLASSPATH% com.on.ccm.dbserver.DbServer
    6. Type the following:

      ccmshell -f ccmrmi.ini -s bind ccmrmi.exe
    7. Start the database service and its dependent services by typing the following:

      ccm start
    8. Watch the Java.exe memory.
      In case of high load it, should now exceed 80 MB, if required.

    To fine-tune the Desktop Agent Support service
    1. Stop the CCM services.
    2. Load %SME_ROOT%\dbin\jdbapi.jpf into any text editor.
    3. Browse to theMaxHeap section.
    4. Set MaxHeapMB=200
    5. Delete the hash sign (#) at the start of the line.
    6. Start the services.

    General recommendations
    The performance of the CCM server can be optimized in combination with the following hardware recommendations: For each 1000 clients, allow approximately 512 MB of RAM and one CPU.



Technical Information
Fine tuning Java Memory management is a delicate issue. Because Java memory allocation is different from C++ programs, Java does not allocate memory at run time for each individual thread, but for the JVM in general. Also Java does not unregister allocated memory space automatically when the thread closes. Unused Java memory is periodically cleared by a separate clean-up thread called the garbage collector.


    The default Java memory settings are 64 MB, which might be inappropriate in a larger environment, in which the garbage collector may run on a permanent basis. An indicator would be high CPU activity over a long period of time.

    Do not set the heap size to high because that will prevent the garbage collector from properly cleaning up the JVM memory.



Legacy ID



2002111203434960


Article URL http://www.symantec.com/docs/TECH108440


Terms of use for this information are found in Legal Notices