I am running a SolrCloud on k8s with the following setting:
Heap params:
-server -Xms280m -Xmx312m
Other params:
-XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseAdaptiveSizePolicy -XX:ParallelGCThreads=4 -XX:AdaptiveSizePolicyOutputInterval=1 -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:MaxGCPauseMillis=300 -XX:GCTimeRatio=19 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=128m -XX:MaxMetaspaceFreeRatio=90 -XX:MetaspaceSize=96m -XX:+ParallelRefProcEnabled
And the max heap shown on the admin page is only 277.5m, which is 34.5m less than Xmx
And if I change the heap params to
-server -Xms312m -Xmx312m
Then the max heap is around 300m, which is much closer to the Xmx
My questions is that:
- Why is there such a big difference in the first setting?
- Why does the difference get smaller when I set Xms = Xmx
- Would JVM still honor my Xmx setting? (Would my application still be allowed to grow to 312m?)
More observations...
I've tried this with another memory setting:
-server -Xms296m -Xmx360m
and the max heap shown on Solr's admin UI is 320m
After doing some math, it seems that the max heap is always around 90% of the Xmx I set.
312 * 0.9 = 280.8 (just 3.3m more than 277.5m)
360 * 0.9 = 324 (just 4m more than 320m)
Why is this happening?