Commit bbb20129 authored by Matt Pryor's avatar Matt Pryor
Browse files

Set memory options for JVM better for containers

parent 2d860319
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -88,8 +88,8 @@ data:
  # The resources for log-tailing containers
  logTailResources:
    requests:
      cpu: 5m
      memory: 10Mi
      cpu: 1m
      memory: 1Mi

  # Configuration for the THREDDS pod
  thredds:
+5 −6
Original line number Diff line number Diff line
#!/usr/bin/bash
# Environment variables for ESGF tomcat instances
# Environment variables for containerised tomcat instances

# Allow the heap size to be set using an environment variable, using 2GB by default
JAVA_MAX_HEAP_MB="${JAVA_MAX_HEAP_MB:-2048}"
# By default, set the initial allocation to 50% of the max
JAVA_INITIAL_HEAP_MB="${JAVA_INITIAL_HEAP_MB:-$(($JAVA_MAX_HEAP_MB / 2))}"
CATALINA_OPTS="-server -Djava.awt.headless=true -Xmx${JAVA_MAX_HEAP_MB}m -Xms${JAVA_INITIAL_HEAP_MB}m"
# By default, get CPU and memory limits from the container's cgroup
# Also allow the heap to use 80% of the available memory - this allows space for loaded classes etc.
# See https://medium.com/adorsys/usecontainersupport-to-the-rescue-e77d6cfea712
CATALINA_OPTS="-server -Djava.awt.headless=true -XX:+UseContainerSupport -XX:MaxRAMPercentage=80.0"
CATALINA_OPTS="$CATALINA_OPTS $CATALINA_EXTRA_OPTS"
export CATALINA_OPTS