How to change the minimum and maximum heap size in WebSphere

Home > Search > How-to
  by

To change the heap size.

  1. Sign into the WebSphere web console.
  2. In the left panel, expand Servers > Server Types, and select WebSphere application servers.
  3. Select the application server.
  4. Expand Java and Process Management and select Process definition.
  5. Select Java Virtual Machine.
  6. Update the Initial heap size and/or Maximum heap size.
  7. Select Apply.
  8. Select Save.
  9. 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. 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments