Introduction
A Mendix app runs on a Java Virtual Machine (JVM), which allocates memory for various purposes. This memory is divided into two categories: heap memory and non-heap memory. The heap memory specifically contains instances of Java objects.
The server memory includes the entire JVM, along with its non-heap and heap components. It also contains other functions that enable the JVM to start and connect to the service layer of our infrastructure if running in the Mendix Public Cloud. For a better understanding of JVM and server memory, refer to What is Java Virtual Machine (JVM) Memory and Service Memory in Mendix Cloud.
This article explains the heap size value allocated to different application container sizes (or cloud resource packs), which is determined by the amount of server or app memory offered in each pack.
Environment/Prerequisites
Applications hosted in Mendix Cloud
Details
The heap size value is set in the Mendix Cloud Foundry Buildpack code, as described below, and it is categorized by the cloud resource pack and its memory offer. For an overview of the memory offered in the Mendix cloud resources packs, refer to Cloud Resources Pack.
App RAM limit >= 32768: [XXL container] heap_size = limit - 4096 App RAM limit >= 16384: [XL21 container] heap_size = limit - 3072 App RAM limit >= 8192: [L container] heap_size = limit - 2048 App RAM limit >= 4096: [M container] heap_size = limit - 1536 App RAM limit >= 2048: [S container] heap_size = limit - 1024
For example, an M21-Standard cloud resource pack or container includes 4 GiB of app memory (or RAM). Then, since 4 GiB is 4096 MiB it falls under the following condition:
App RAM limit >= 4096: [M container] heap_size = limit - 1536
The heap size for a M21-Standard container with 4GiB is determined as follows:
limit = 4096 heap_size = limit - 1536 heap_size = 4096 MiB - 1536 MiB heap_size = 2560 MiB (it is equal to 2.5 GiB of memory, 2560/1024 = 2.5 GiB)
For any container with a memory limit below the conditions specified above, the following applies:
heap_size = App RAM limit / 2
For the previously mentioned M21-Standard container with 4GiB of memory, the JVM Object Heap graph would display as follows, with a 2.5GiB value on the vertical axis:
Suppose the heap memory shown in the graph differs from the expected value. In that case, it is possible that the heap size was altered using an unsupported environment variable, as explained in the article How to change the HEAP_SIZE as an unsupported environment variable. Please be aware that setting an unsupported variable is at the customer's own risk, and Mendix support will not be able to assist with any issues resulting from it.
Internal Information Related
- Zendesk ticket #226972
- Slack thread #cloud-totw
0 Comments