Changing Xmx and other memory settings for External Purge on Unix or Linux

By default, the ExternalPurge Java heap size is equivalent to the IBM B2B Sterling Integrator Java heap size on a Unix or Linux installation.

In order to set a custom Java heap size for External purge, perform these following:
  1. Use the following command to copy the ExternalPurgeConsole.sh script to a temporary script available in your <B2Bi_install>/bin> directory:

    For example: cp ExternalPurgeConsole.sh myTemp.sh.

  2. Edit myTemp.sh to echo the JAVA_SERVER variable.
    1. Locate the line tmp.sh in your myTemp.sh file.
    2. Add echo $JAVA_SERVER in the next line, after tmp.sh.
    3. Delete all lines after echo $JAVA_SERVER leaving the last line exit 0.

      For example:

      . /opt/app/IBM/B2Bi61/bin/tmp.sh
      echo $JAVA_SERVER
      exit 0
      
    4. Save myTemp.sh.
  3. Run myTemp.sh and copy the output into a text editor.

    For example: <B2Bi_install>/bin>./myTemp.sh.

  4. Edit any of the following memory parameters –Xms , –Xmx , –Xmns, and –Xmnx, as required.
    Note: If you change the -Xmx, then the –Xmnx should be approximately 25 to 30 % of the -Xmx. For example, if you increase the -Xmx to 2048 MB, then increase the nursery -Xmnx to 512 MB.
  5. In the <B2Bi_install>/bin> directory, backup the ExternalPurgeConsole.sh.in file.

    For example:

    cp ExternalPurgeConsole.sh.in ExternalPurgeConsole.sh.in.bak.
  6. In the <B2Bi_install>/bin> directory, edit the ExternalPurgeConsole.sh.in.
  7. Locate the last tmp.sh entry and add a new line below #:endif

    JAVA_EXTPURGE="<paste your modified output from steps #3 and #4>". .

    For example:

    #:ifdef USE_NEW_INSTALL
    . &BIN_DIR;/tmp.sh
    #:else
    . &HOME_DIR;/tmp.sh
    #:endif
    JAVA_EXTPURGE="/opt/apps/IBM/B2Bi61/bin/java_wrapper.sh -Xms1024m -Xmx2048m…"
    
    Note: Embed the output within double-quotes.
  8. Additionally, edit the ExternalPurgeConsole.sh.in file and and replace the existing ${JAVA_SERVER} variable with the new ${JAVA_EXTPURGE} variable.

    For example:

    ${ECHO} "Starting Purge..."
    
    ${JAVA_EXTPURGE} -Dvendor=shell -DvendorFile=&PROP_DIR;/servers.properties -classpath &JAR_DIR;/bootstrapper.jar com.sterlingcommerce.woodstock.noapp.NoAppLoader -f &PROP_DIR;/dynamicclasspath.cfg -class com.sterlingcommerce.woodstock.services.archive.purge.hpp.QueueController -invokeargs $@
  9. Run the setupfiles.

    For example: <B2Bi_install>/bin>./setupfiles.sh.

  10. Start External Purge.

    For example:

    ./control_extpurge.sh start
  11. Capture a thread dump (javacore) using the following command from the <B2Bi_install>/ directory:

    Thread dump (javacore) is available in the <B2Bi_install>/bin directory.

    ps -ef | grep $(ps -ef | grep -f extpurge.pid | grep 'QueueController' | awk '{print $2}') | grep 'jdk/bin' | awk '{print $2}' | xargs kill -3
  12. Verify the memory changes like -Xmx and the –Xmnx in the thread dump.

    For example:

    $ grep "2CIUSERARG.*Xmx" javacore.20210429.183746.22457.0004.txt
    2CIUSERARG	-Xmx2048m
    grep "2CIUSERARG.*Xmnx" javacore.20210429.183746.22457.0004.txt
    2CIUSERARG	-Xmnx512m