Weblogic Server : Custom Memory Heap Setting For Each Server
This is one of my favorite question which i frequently asked in lot's of interviews. We all know to change or alter memory heap size we have to chnage -Xms and -Xmx parameters either in setDomainEnv.sh or in startup script for managed servers startManagedServer.sh, but what would be case if I need to set different heap size for each managed servers? Yes, one way you most of the guys know is just create different startup script for each managed server and start server with the help of that, but most of the guys struggled a lot why changed heap is not reflecting even modified the startup scripts for all managed servers. so here are the reason and different ways which we can used to define different heap for different managed servers.
First, if you created separate startup files for each managed server then you have to make sure, inside each startup script, you should not be calling setDomainEnv.sh or commEnv.sh, otherwise your memory parameters will be override by the values existing in this script. So, make sure to define your memory heap parameters after any place where you are calling above scripts in your startup scripts.
Ok, Now here are different ways -
1. For Admin Server
Since, startWebLogic.sh is the script only used to start admin server, thus whatever the value you will update will reflect but only make sure you are updating new values after the place where you are calling, or i will add the values here in script
MEM_ARGS="-Xms<value>m -Xmx<value>m"
export MEM_ARGS
2. For Managed Server(s)
You can have four ways to assign different memory arguments for managed servers
2.1
Start your managed server as below
where <Name_Of_Managed_Server> is your managed server name.
<Admin_URL> is the Adminstration Server URL, for example http://localhost:7001
<value> in -Xms<value>m -Xmx<value>m, is the desired heap size, for example, -Xms512m -Xmx512m
2.2
Create custom scripts for each managed server and add memory heap parameters after you are calling setDomainEnv.sh, add as below
After the JAVA_OPTIONS = "... {JAVA_OPTIONS}" line type:
JAVA_OPTIONS="${JAVA_OPTIONS} -Xms<value>m -Xmx<value>m"
If you are using the Node Manager then, From admin console, select the server, <Managed_Server> then configuration then Server Start then arguments, then add -Xms<value>m -Xmx<value>m under the arguments tab.
Directly edit the config.xml file and add argument as below
<server>
<name>MS1</name>
...
<server-start>
<arguments>-Xms128m -Xmx128m</arguments>
</server-start>
...
</server>
No comments:
Post a Comment