Skip to content

Instantly share code, notes, and snippets.

@svanoort
Created March 18, 2016 13:11
Show Gist options
  • Save svanoort/532a6918389b3a0e9dd4 to your computer and use it in GitHub Desktop.
Save svanoort/532a6918389b3a0e9dd4 to your computer and use it in GitHub Desktop.
Tuning Java for minimal memory footprint
One source: http://developers.redhat.com/blog/2014/07/22/dude-wheres-my-paas-memory-tuning-javas-footprint-in-openshift-part-2/
# Set the XMX to cap your max heap, set the xms to a reasonable minimum
-Xmx384m -Xms100m
# No more than 40% of heap free, lowest GC overhead and keeps heap small - still under 0.5% GC time
seropt:
-XX:+UseSerialGC -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40
# parallel version, allows up to 4% time spent on GC, generally uses heap more efficiently, but at cost of 2x the CPU USE
# still going to run under 1% CPU most times (say 0.7%), but improves more and more with increase in # CPUs
paropt:
-XX:UseParallelGC -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment