Skip to content

Commit

Permalink
Reduce the default min heap size and remove the default max heap size
Browse files Browse the repository at this point in the history
For historical reasons we were setting the initial heap size to the same
value as the max heap size: 4GiB.
However, based on experimentation, our memory pool usage is around
512MB for an idle server.
The cost dynamics of cloud make it more important to set an appropriate
initial heap size and memory management in the JVM has gotten better
over time.

As for the max heap size, OpenJ9 has intelligent defaults when running
within a container, and so we should use those instead of guessing at a
default of our own:
https://www.eclipse.org/openj9/docs/xxusecontainersupport

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
  • Loading branch information
lmsurpre committed Oct 6, 2021
1 parent 0fdd754 commit 7294f0b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 2 additions & 0 deletions fhir-server/liberty-config/configDropins/defaults/jvm.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set a fixed, higher than default, initial heap size that could serve a moderate workload
-Xms768M
11 changes: 6 additions & 5 deletions fhir-server/liberty-config/configDropins/disabled/jvm.options
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Reduced heap size for constrained environments
# Set a fixed max heap size
-Xmx3072M

# Initial heap size (same as max so no reallocations will occur)
-Xms3072M
# Turn on verbose classloading
-verbose:class

# Maximum heap size
-Xmx3072M
# Turn on verbose garbage collection
-verbose:gc
11 changes: 1 addition & 10 deletions fhir-server/liberty-config/jvm.options
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,4 @@
-Dcom.ibm.jsse2.renegotiate=DISABLED

# Prevents Apache Xerces from overactively using the service loader to find a class
-Dorg.apache.xml.dtm.DTMManager=org.apache.xml.dtm.ref.DTMManagerDefault

# Initial heap size (same as max so no reallocations will occur)
-Xms4096M

# Maximum heap size
-Xmx4096M

# Uncomment to turn on verbose classloading
#-verbose:class
-Dorg.apache.xml.dtm.DTMManager=org.apache.xml.dtm.ref.DTMManagerDefault

0 comments on commit 7294f0b

Please sign in to comment.