Overview
Version
| WebLogic Server Version |
|---|
Weblogic Server 12.2.1.3 and later versions |
Application Scenario
1. After WebLogic Server is deployed, if too many programs run on the server and the default allocated memory is too small, Out of Memory (OOM) errors may occur, causing the server to hang.
2. For convenience, you want to change the server port instead of using the default port.
Function Description
The document describes how to modify the port number and memory settings for WebLogic Server.
Note: Modifying the Port Number
1. Log in to WebLogic Server Administration Console as the admin.
2. In the console, choose Environment > Servers and click AdminServer (admin) to enter the setting page.
3. Modify the value of Listen Port and click Save.
4. Restart WebLogic Server to apply the change.


Modifying Memory Settings
On WebLogic Server 12, you (the admin) can modify memory settings by editing the setDomainEnv file.
You are advised to modify the following memory-related parameters.
| Parameter | Description | Recommended Value |
|---|---|---|
-Xmx | -Xmx defines the maximum memory size of the Java heap. It sets an upper limit for the Java heap. When the heap reaches the defined size, the JVM stops allocating new memory, and garbage collection is triggered. | 8 GB ≤ -Xmx ≤ 32 GB You can view the recommended on-heap memory size (the -Xmx value) in an inspection report in Health Inspection. |
-Xms | -Xms defines the initial memory size of the Java heap. The JVM allocates memory of the defined size as soon as it starts. | Equal to -Xmx |
-XX:MaxPermSize | -XX:MaxPermSize defines the maximum size of the Permanent Generation (PermGen) memory space, a special memory region in the JVM where metadata about loaded classes, methods, and static variables is stored. | Equal to 1/2 * -Xmx |
-XX:MaxDirectMemorySize | -XX: MaxDirectMemorySize sets an upper limit for the direct memory allocated by Java NIO, which is a common form of off-heap memory. Since the direct memory is allocated from the native memory outside the Java heap, the direct memory size is not limited by the heap size. | 2 GB |
Linux
1. Go to the bin directory of the WebLogic Server domain and locate the setDomainEnv.sh file.
2. Open the setDomainEnv.sh file with a text editor. Add the following lines to the file.
MEM_ARGS="-Xms8g -Xmx8g -XX:MaxPermSize=4g -XX:MaxDirectMemorySize=2g"
3. Save and close the setDomainEnv.sh file.
4. Restart WebLogic Server to apply the changes.
Windows
1. Go to the bin directory of the WebLogic Server domain and locate the setDomainEnv.cmd file.
2. Open the setDomainEnv.cmd file with a text editor. Add the following lines to the file.
set MEM_ARGS=-Xms8g -Xmx8g -XX:MaxPermSize=4g -XX:MaxDirectMemorySize=2g
3. Save and close the setDomainEnv.cmd file.
4. Restart WebLogic Server to apply the changes.
Effect Display
After restarting WebLogic Server, you can see the updated memory settings in JAVA Memory arguments.