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



8 comments:

  1. Hi,

    just use the nodemanager and set the startup arguments of the managed servers in the wls console. Always works, easy to find back and change easily.

    ReplyDelete
  2. Hi,

    Yes this is just another way....I have provided the link to the post using start-up arguments as well.

    ZB

    ReplyDelete
  3. Is this may cause my application to be faster?

    ReplyDelete
  4. Hi Reminder,

    Tuning of apps could be coding issue but yes this is one of the tuning configuration.

    Usually when no Heap left in the JVM it crashes with famous OutOfMemory Error. This is one way to fix it.

    ZB

    ReplyDelete
  5. How do I state the jvm heap size if I am starting the managed servers using WLST command i.e. start(managed_server_name,type). Both the above options dont work.

    Thanks.

    ReplyDelete
  6. Hi Sameer,

    Check this link http://docs.oracle.com/cd/E11035_01/wls100/config_scripting/monitoring.html

    ZB

    ReplyDelete
  7. Hi Zeeshan,

    When we added xms and xms values for admin server in setDomain.sh, the size of admin server increased, but the managed server size changed to "-Xms256m -Xmx1024m",

    ReplyDelete
    Replies
    1. If you are using NodeManager then set these settings in WebLogic console. Also if you are using some other products such as SOA Suite or WLS 12c then settings would be in different file. Unfortunately I don't remember the filename on top of my head, its been a while working with Oracle stuff ;)

      Cheers,
      Z

      Delete