Closed rbelnap closed 2 years ago
Added 3 env vars to the example repo:
$XMX
controls the JVM -Xmx
argument. Defaults to 512M
$XMS
controls the JVM -Xms
argument. Defaults to 64M
$JVM_ARGS
additional arbitrary JVM args.
Additionally added the flag to die on OOM errors.
@Foxcapades I wonder if we would benefit from adding this flag also, to help understand from the logs what we were dealing with. It prints out the heap sizes (and other information) chosen by the JVM based on current system information:
-XX:+PrintCommandLineFlags
@rbelnap Is there a benefit to NOT specifying Xmx/Xms specific defaults? Seems like the JVM will pick values based on available resources if not specified. I guess that is less predictable. Any reason to choose that instead?
I guess I'm wondering if we should just stick with this, and roll any memory config into the generalized JVM_ARGS param?
ENV JAVA_HOME=/opt/jdk \
PATH=/opt/jdk/bin:$PATH \
JVM_ARGS=""
COPY --from=prep /jlinked /opt/jdk
COPY --from=prep /workspace/build/libs/service.jar /service.jar
CMD java -jar -XX:+CrashOnOutOfMemoryError $JVM_ARGS /service.jar
We need a way to set jvm args, most notably
-XX:ExitOnOutOfMemoryError