Quick Search,,,

Sunday, January 3, 2016

How to set customized memory settings for Weblogic Server instances: Admin Server and Managed Servers?

GOOD DAY,,,
This Blog describes how to set customized memory settings for WebLogic Server instances: Admin Server and Managed Servers.

Setting Custom Memory Settings for the Admin Server:
Memory settings for the Admin Server can be modified by editing the $MW_HOME/user_projects/domains/domain_name/bin/setDomainEnv startup script. Specify the USER_MEM_ARGS parameter to override the value constructed by the startup scripts:
USER_MEM_ARGS="-Xms(value)m -Xmx(value)m"
export USER_MEM_ARGS

Note that other environment-setting scripts like setSOADomain etc. also specify USER_MEM_ARGS. So ensure that this specification is made AFTER calling any such scripts, but before USER_MEM_ARGS is assigned to MEM_ARGS (which is where it overrides the other memory arguments.
USER_MEM_ARGS overrides the memory settings for all the startup scripts, so it will take effect for managed servers as well unless one of the methods to override it below are employed.

Setting Custom Memory Settings for the Managed Server:

There are four options available to set memory arguments for Managed Server instance. To edit memory values, implement one of the following:


1. When starting a managed server through the
  $MW_HOME/user_projects/domains/(domain_name)/bin/StartManagedWebLogic script, 
  you can add the memory arguments desired.
  a. First set the domain environment by calling setDomainEnv.
  b. Call StartManagedWebLogic (ManagedServerName) (AdminURL) -Xms(value)m -Xmx(value)m
        where
         (ManagedServerName): is your managed server to be started.
       (AdminURL)           is the Adminstration Server address, e.g., http://localhost:7001.
       (value):                  is the desired heap size i.e: -Xms256m -Xmx256m to get a fixed 
                                    heap size.
  c. You still will see something like this in the output:
       JAVA Memory arguments: -Xms512m -Xmx512m
       but that is overridden by the given arguments.

2. Create a custom Start Managed Weblogic script. Make a copy of 
  StartManagedWebLogic and edit the following:
  a. After the JAVA_OPTIONS = "... {JAVA_OPTIONS}" line type:
          JAVA_OPTIONS="${JAVA_OPTIONS} -Xms(value)m -Xmx(value)m"
  b. You still will see something like this in the output:
          JAVA Memory arguments: -Xms512m -Xmx512m
         but that is overridden by the given arguments.
  c.  Check the Note remark below when creating a script.

3. Sending the Startup Memory Arguments when you 
   have NodeManager configured. When you have your Managed 
   Server instances configured to be controlled by Node Manager, the 
   memory arguments can be passed as startup parameters from the 
   Admin Console.
   a. From the Admin Console, select the server instance you want to start:
        (ManagedServerName) -> Configuration -> Server Start -> Arguments
   b. In the 'Server Start' page for the managed server in the admin console, add the
        memory values-Xms(value)m -Xmx(value)m under the arguments tab.

4. Modify the $MW_HOME/user_projects/domains/domain_name/config/config.xml
    file. Add the (server-start) tags and inside add (arguments) as in 
    the following example:
     
    Verify the configured memory values in the Admin Console by navigating to
    Servers -> (ManagedServerName) -> Monitoring -> Performance. 
    On this page, you will see Heap Size Current for the current heap size. 
    This value is listed in bytes.

NOTE: It's not recommend editing the config.xml file directly as a simple mistake could cause your entire domain to fail to start up correctly. If you do choose this method, make sure you have a backup copy of the config.xml file available in case of problems. These same methods also apply to other Java options, for instance, debug flags.


Verifying the Heap Memory Settings 

You can use the WebLogic Administration Console.
Having the Admin Server Up and Running, access the console.
Click on Environment, Servers and for each server, on the 

Monitoring -> Performance tab.
There you will see all of the Heap information, Current Size, Current free, Free Percent and Maximum Heap Size. (These values are in Bytes, so to get the estimated set value of the memory arguments, divide it by 1024 ).



Enjoy,
Mohammad K. Faidi
 "Think Positive"

No comments:

Post a Comment