Friday, January 6, 2012

How to set Different JVM Heap Sizes for Admin and Managed Servers in Weblogic

Hi,

As per performance tuning guidelines it is good practice to start your Admin server with lower JVM heap size than your other managed servers because the Admin server doesn't required much resources.
By doing this you can utilize the free memory with others where it is needed (This makes sense when you are running Admin and Managed servers on same host)

Problem:
As i mentioned above our requirement is to use different JVM heapsize for Adminserver and only specific webcenter WLS_Spaces servers of a cluster.

One way to change the heap size is to set in weblogic admin console click here

In the example i will set JVM heap size -Xms and -Xmx values to1MB for AdminServer and 2MB each for WLS_Spaces managed servers of a cluster.

Solution:

1. Shutdown Admin and Managed servers

2. Add the following line of code in setDomain.env file. you can find the file under bin directory of weblogic domain home

Make sure you add these lines at-least after "export XMX_JROCKIT_32BIT" so it will override any other default settings.

e.g. /u01/Oracle/Middleware/user_projects/domains/myDomain/bin

# Set 1024MB for AdminServer

if [ "${SERVER_NAME}" == "AdminServer" ] ; then
      USER_MEM_ARGS="-Xms1024m -Xmx1024m"
    export USER_MEM_ARGS
fi

#Set 2MB if server name contains WLS_Spaces ( it will cover WLS_Spaces1,2,3,4..)

if [[ "${SERVER_NAME}" == *WLS_Spaces* ]] ; then
    USER_MEM_ARGS="-Xms2048m -Xmx2048m"
    export USER_MEM_ARGS
fi

3. Start Adminserver to verify if your change is working (if ok then start all others)

4. Verify by check the JVM heapsize using Jrockit mission control or Linux process
e.g. $ ps -ef|grep AdminServer




Have a nice day,
Zeeshan Baig