Search code examples
ibm-cloudcloud-foundrywebsphere-libertyheap-size

How is the heapsize setting for a CF Liberty instance with a particular memory limit


For a CF App (Liberty Runtime based) running on bluemix, I have set a MEMORY_LIMIT say 2G. I dont have any JAVA_OPTS set for setting the -Xms and -Xmx values. How is the heapsize memory allotted by bluemix ? Any range it sets by default ?

Please advice.


Solution

  • The Liberty buildpack uses a ratio to calculate the heap size according to your memory limit.

    heap_size_ratio The ratio that is used to calculate the maximum heap size. The default heap size ratio is 0.75 (75% of the total available memory).

    https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack/blob/master/docs/ibm-jdk.md

    new_heap_size = mem * heap_size_ratio

    https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack/blob/master/lib/liberty_buildpack/jre/ibmjdk.rb#L175