I'm using spring boot 2.5.6 and I'm generating the docker image with the spring boot maven plugin. I'm deploying the application using AWS EKS with nodes managed by fargate.
The plugin configuration is the following
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
The command I use to execute it is the following
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=my-image-name
When the application is deployed on AWS EKS, the application print the following data
Setting Active Processor Count to 2
Adding $JAVA_OPTS to $JAVA_TOOL_OPTIONS
Calculated JVM Memory Configuration:
-XX:MaxDirectMemorySize=10M
-Xmx408405K
-XX:MaxMetaspaceSize=128170K
-XX:ReservedCodeCacheSize=240M
-Xss1M
(Total Memory: 1G, Thread Count: 250, Loaded Class Count: 20215, Headroom: 0%)
Enabling Java Native Memory Tracking
Adding 128 container CA certificates to JVM truststore
Spring Cloud Bindings Enabled
Picked up JAVA_TOOL_OPTIONS:
-Djava.security.properties=/layers/paketo-buildpacks_bellsoft-liberica/java-security-properties/java-security.properties
-XX:+ExitOnOutOfMemoryError
-XX:ActiveProcessorCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath="/var/log/containers/heapDump.hprof"
-XX:MaxDirectMemorySize=10M
-Xmx408405K
-XX:MaxMetaspaceSize=128170K
-XX:ReservedCodeCacheSize=240M
-Xss1M
-XX:+UnlockDiagnosticVMOptions
-XX:NativeMemoryTracking=summary
-XX:+PrintNMTStatistics
-Dorg.springframework.cloud.bindings.boot.enable=true
If I go inside the container and I run the command "free -h" I get the following output
total mem : 7.7G
used mem : 730M
free mem : 4.6G
shared : 820K
buff/cache : 2.4G
available
Why the -Xmx is filled with 400Mb only? And why the total memory is only 1Gb?