0

We have a requirement where the total application jvm memory is too high and is varying based on the input dataset. So we have no idea about the maximum heap size to be set using the -Xmx command line option. The total memory needed is greater than the default maximum heap size( 1/4 -th of the total physical memory).

When we are not giving any GC ergonomics command line parameters, memory is not growing after 9-9.5 GB( The total physical memory in the system is 38GB). And application would get stuck at this point.

If we give the Xmx value to 20 GB, application is running. But we are not sure about the maximum heap size value since it can change according to the input data. Please advise on how to proceed in this case. Do we have any option to increase the heap memory beyond the Xmx value? Thanks for the help.

junsid
  • 335
  • 3
  • 14

2 Answers2

2

Try using -Xmx along with -Xms. Provide -Xms with the minimum required value (20GB) and -Xmx with the maximum possible value for your operating system.

Yaroslav Rudykh
  • 803
  • 6
  • 12
1

Since memory is not growing beyond 9-9.5GB initially,

set -Xms as 9 GB

and set -Xmx as maximum available physical memory - 1 or 2 GB if no other process is running ( 30 GB for 32 GB RAM machine )

You have fine-tune garbage collection algorithm apart from these memory setting.

CMS is effective if both -Xms and Xmx have same value.

For larger heaps, G1GC is very effective. You can have different values for minimum and maximum heap and it works fine if you properly fine-tune relevant parameters.

Have a look at related SE question:

Java 7 (JDK 7) garbage collection and documentation on G1

and

Selecting a collector article

Community
  • 1
  • 1
Ravindra babu
  • 37,698
  • 11
  • 250
  • 211