Closed corneliusroemer closed 2 months ago
A simple way of allowing custom JVM_OPTS would be to use an entrypoint.sh script instead of the current https://github.com/GenSpectrum/LAPIS/blob/60862b7c7834dfb8bfbdba9bd147c982bada14e5/lapis2/Dockerfile#L17-L23
The entrypoint would then be ENTRYPOINT ["./entrypoint.sh"]
and entrypoint.sh would look like:
#!/bin/sh
JVM_OPTS=${JVM_OPTS:-}
# Take script arguments
ARGS="${*}"
if [ -n "$JVM_OPTS" ]; then
CMD="java $JVM_OPTS -jar app.jar --spring.profiles.active=docker --referenceGenomeFilename=./reference_genomes.json $ARGS"
else
CMD="java -jar app.jar --spring.profiles.active=docker --referenceGenomeFilename=./reference_genomes.json $ARGS"
fi
echo Running:
echo "$CMD"
$CMD
If one wants LAPIS to release unused heap back to the system, it's necessary to add JVM_OPTS like this:
because otherwise the JVM is happy to reserve a lot of memory, close to the allocated memory, even though little of the heap is in fact used.
I can't see from the docs whether or not, and if so how to add those JVM_OPTS.
A current workaround to limit LAPIS memory usage is to limit available memory tightly, e.g. via memory limits in kubernetes. But it would be good to have high limits and still use minimum memory whenever possible.