FIX found for ORS not booting correctly, working config

Hi Fellows,

I’ve just spent countless hours to determine, what is wrong with my setup and it seems that the
number of threads has to be 1 … so the issue is something concerning multi-threading.

Here’s my working ors-config with minimal settings, car and electric bicycle profiles active:

##### openrouteservice settings file #####
# This file contains parameters for openrouteservice.
# For a full list of possible parameters see https://giscience.github.io/openrouteservice/run-instance/configuration/

##### General server settings #####
server:
  port: 8082
  error:
    whitelabel:
      enabled: false
  # Keep the context-path at / else the war file run with tomcat will have the context-path of /ors/v2 as well.
  servlet:
    context-path: /ors
  tomcat:
    keep-alive-timeout: 30000
spring:
  profiles:
    active: default
  mvc:
    servlet:
      path: /
##### Settings related to springdoc #####
#springdoc:
#  swagger-ui:
#    enabled: true
#    path: /swagger-ui
#    tryItOutEnabled: true
#    filter: false
#    syntaxHighlight:
#      activated: true
#    showExtensions: true
#  api-docs:
#    path: /v2/api-docs
#    version: OPENAPI_3_0
#  packages-to-scan: org.heigit.ors
#  pathsToMatch: /v2/**
##### Logging settings #####
logging:
  file:
    name: ./logs/ors.log
  pattern:
    console: "%d{yyyy-MM-dd HH:mm:ss} %highlight{%-7p} %style{%50t}{Cyan} %style{[ %-40.40c{1.} ]}{Bright Cyan}   %m%n"
    file: "%d{yyyy-MM-dd HH:mm:ss} %p [%-40.40c{1.}] - %m%n"
  level:
    root: INFO
##### openrouteservice specific settings #####
ors:
  cors:
    allowed_origins: "*"
    allowed_headers: Content-Type, X-Requested-With, accept, Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization
    preflight_max_age: 600
#  messages:
#  ##### ORS endpoints settings #####
  endpoints:
    routing:
      enabled: true
    matrix:
      enabled: true
    isochrones:
      enabled: true
    Snap:
      enabled: true
#  ##### ORS engine settings #####
  engine:
    source_file: /home/ors/files/the-map.osm.pbf
    init_threads: 1
    preparation_mode: false
    graphs_root_path: ./graphs
    graphs_data_access: RAM_STORE
    elevation:
      preprocessed: false
      data_access: MMAP
      cache_clear: false
      provider: multi
      cache_path: ./elevation_cache
    profiles:
      car:
        enabled: true
      bike-electric:
        enabled: true
 

… well now the issue is OOM, but I can handle it :slight_smile: … I modify the Dockerfile to force min at least 16G / max of 64G …

2 Likes

Hello, im glad you were able to find a solution in your app, im still trying to figuring it out in Kodular but its already beyond my scope, my apps were working since last year, now all of a sudden, since last April it will have an Error 4003: Routing Service Failed with Error 404.

I don’t think there is an issue with the config parameter init_threads. According to the docs it defines

The number of threads used to initialize (build/load) graphs. Higher numbers requires more RAM

As such, its value is supposed to be set to a number adequate to your server setup, i.e., multiple init threads make sense only if there are multiple cores available, and you probably wouldn’t want to set it higher than the number of cores. The multithreading is performed at the level of individual profiles. Building profiles in parallel rather than sequential increases the memory requirements roughly by a multiply of the number of threads, as for each profile a separate routing graph needs to be build.

Well, I tried with multiple threads, but it does not work.