cinqict

Thursday, March 14, 2013

Setting memory and other java options

In the domain home directory, there is a file setDomainEnv.sh (I'm ignoring windows here...)

There is a section called USER_MEM in that file, which can be used to adjust java settings on servername basis.
You can use regular expressions like so:

 # IF USER_MEM_ARGS the environment variable is set, use it to override ALL MEM_ARGS values
if [ "${SERVER_NAME}" = "AdminServer" ] ; then
        USER_MEM_ARGS="-Xms512m -Xmx1024m"
        MEM_ARGS="${USER_MEM_ARGS}"    
        export USER_MEM_ARGS
else
        USER_MEM_ARGS="-Xms2048m -Xmx2048m"
        MEM_ARGS="${USER_MEM_ARGS}"
        export MEM_ARGS
fi


That would set the memory to 2gb min max for all servers, except the AdminServer.

You can alse use regex like this:

# jdk settings
if echo ${SERVER_NAME} | grep -Eq '^osb' ; then
        EXTRA_JAVA_PROPERTIES="${EXTRA_JAVA_PROPERTIES} -Xcompressedrefs "
        export EXTRA_JAVA_PROPERTIES
fi


That is; For all servernames, starting with osb... use 32bits references.

No comments:

Post a Comment