I am doing a matrix using curl from the command line to my local host ors-app. The matrix is ~1,100 X 1,100 in size. I’m using the entire continental US pbf, which comes in at about 9.41 GB for the graphs. I have disabled elevations as I’m not too concerned with the heights. When the command is executed, it runs for a couple of minutes then returns a “java.lang.OutOfMemoryError: Java heap space” error.
Being a noob with Java heap spaces and Docker, I foolishly increased the amount of RAM my docker uses from 14GB to 20GB, but the error continued.
I’ve been able to find exactly what is happening, based on these web pages,
This paragraph says it all.
So what’s wrong with JVM? The JVM is not fully aware of the isolation mechanism used in containers . Containers are not like VMs, they are basically isolated linux process groups. Java application running in docker container always sees the full resources of the host. That means when you run a dockerized Java application in a VM having 128GB RAM, your java application thinks that 125GB RAM belongs to it.
So my question is, how do I overcome this? I’ve set the docker-compose.yml file Java settings to this
- "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms7g -Xmx14g"
As I had to do this to even get the container to build. I’ve verified that the container runs with fewer input locations to the matrices, however there is no joy when I need to run the full matrix.
At this point I’m pretty much at a loss on how to proceed. Ideas?