ORS + Nominatim RAM Saving

Hello!

Im running two service currently.

  • openrouteserve (for directions)
  • nominatim (for geocoding)

My problem is both of these eating a good amount of ram. In my case now around 3-4GB but if want to add more country then the ram usage will increase very fast because of the two service needs lot of ram separatly. Is there any best practice for how to save ram when using ors with geocoding or the current best solution is use these two service(maybe pelias instead of nominatim) and pay the bill?

Thanks for the answer!

Hi @Ducktape,

if you are using the latest openrouteservice, you can set ors.engine.graphs_data_access=MMAP to map the graph data to disk instead of hold everything in RAM, which should reduce the memory requirements for ors a bit.
Of course this comes with reduced performance.

Best regards

Hi, I would very much like to use this, but into what file do I have to insert the line “ors.engine.graphs_data_access=MMAP”? Do I have to rebuild then?

Hi @tobs40,

in the ors-config.yml or pass it as environment variable.

I considered that, but my ors-config.yml has a recursive structure with { brackets and everything. Do I need to break the line up recursively or can I just paste it at the end of the file?

yes. ors.engine.graphs_data_access=MMAP basically resolves to:

ors:
  engine:
    graphs_data_access: MMAP

in YAML
But there shouldn’t be too many brackets in yaml :sweat_smile: ?
Are you sure you are not still using JSON?

This would be my docker-compose.yml then, is it correct?

version: '2.4'
services:
  ors-app:
    container_name: ors-app
    ports:
      - "8080:8080"
      - "9001:9001"
    image: openrouteservice/openrouteservice:v7.1.1
    user: "${UID:-0}:${GID:-0}"
#    build:
#      context: ../
#      args:
#        ORS_CONFIG: ./openrouteservice/src/main/resources/ors-config-sample.json
#        OSM_FILE: ./openrouteservice/src/main/files/heidelberg.osm.gz
    volumes:
      - ./graphs:/home/ors/ors-core/data/graphs
      - ./elevation_cache:/home/ors/ors-core/data/elevation_cache
      - ./logs/ors:/home/ors/ors-core/logs/ors
      - ./logs/tomcat:/home/ors/tomcat/logs
      - ./conf:/home/ors/ors-conf
      - ./europe-latest.osm.pbf:/home/ors/ors-core/data/osm_file.pbf
    environment:
      - BUILD_GRAPHS=True  # Forces the container to rebuild the graphs, e.g. when PBF is changed
      - "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms57g -Xmx57g"
      - "CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.rmi.port=9001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost"

ors:
  engine:
    graphs_data_access: MMAP

no, it would be in the ors-config.yml that is in your ./conf folder.
But you are still using 7.1.1 which doesn’t support that yet.
Best use the docker-compose.yml from the 8.0.0 release:

then you could also set it within the environment block with:

      environment:
        - ors.engine.graphs_data_access=MMAP