To change the heap size.
- Sign into the WebSphere web console.
- In the left panel, expand Servers > Server Types, and select WebSphere application servers.
- Select the application server.
- Expand Java and Process Management and select Process definition.
- Select Java Virtual Machine.
- Update the Initial heap size and/or Maximum heap size.
- Select Apply.
- Select Save.
- Restart the JVM for the change to take effect.
In this example, the initial heap size is 64 MB and the maximum heap size is 256 MB.
Sign onto the server and issue the following command to ensure the JVM has the appropriate initial heap value at runtime. In this example, the JVM has an initial heap value of 64 MB.
~]# ps -ef | grep jvm_name | sed "s| |\n|g" | grep -Xms -Xms64m
Issue this command to ensure the JVM has the appropriate maximum heap value at runtime. In this example, the JVM has an maximum heap value of 256 MB.
ps -ef | grep jvm_name | sed "s| |\n|g" | grep -Xmx -Xmx256m
If you have a tool that produces a graph of the heap, the graph can to used to know what would be a good minimum heap size. For example, in this graph, the steady state for the minimum heap is around 200 MB. In this scenario, a miminum heap of 128 MB would probably be good.
Don't be too surprised if you observe the maximum heap decline after the JVM is restarted. This graph shows a JVMs heap usage over 30 days. Each spike occurs due to the JVM being restarted once a week, followed by a gradual decline until the heap stabalizes.
Based on the maximum heap size of the JVM, and the JVMs needs, WebSphere may attempt to reduce the maximum heap size until the preferred maximum heap size is found. However, if it is taking 24 to 48 hours for the decline to complete, this is usually an indication that the maximum heap size is set too high. When it is taking a long time for the maximum heap to reduce to the preferred heap size, you can set the JVMs maximum heap to be just above the preferred maximum heap.