It seems that no matter what I try, running java -XshowSettings:vm -version
on my container yields the same output
VM settings:
Max. Heap Size (Estimated): 494.94M
Using VM: OpenJDK 64-Bit Server VM
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment 18.9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9, mixed mode, sharing)
I can't figure out how to increase the max heap size from 494.94M
.
Here's my Dockerfile
FROM maven:3.6.3-openjdk-11-slim AS builder
WORKDIR /app
COPY pom.xml .
COPY src src
RUN mvn package
ARG JAR_FILE=target/*.jar
RUN java -Djarmode=layertools -jar ${JAR_FILE} extract
FROM openjdk:11-jre-slim
WORKDIR /app
EXPOSE 8081
COPY --from=builder /app/dependencies/ ./
COPY --from=builder /app/spring-boot-loader/ ./
COPY --from=builder /app/snapshot-dependencies/ ./
COPY --from=builder /app/application/ ./
ENV JAVA_OPTS="-XX:MinRAMPercentage=30 -XX:MaxRAMPercentage=90"
CMD java $JAVA_OPTS org.springframework.boot.loader.JarLauncher
The memory of my ECS task is set to 2048, so setting the max heap at 90% I would expect to see something closer to that.
I have also tried overriding JAVA_OPTS directly in the ECS task definition as well. I keep getting OutOfMemory errors and could really use some help!