GIScience / openrouteservice

🌍 The open source route planner api with plenty of features.
https://openrouteservice.org
GNU General Public License v3.0
1.33k stars 379 forks source link

hgv builds fast-isochrones by default #1078

Open nilsnolde opened 2 years ago

nilsnolde commented 2 years ago

for europe that demands ~ 60 52 GB RAM instead of ~15 GB.

https://github.com/GIScience/openrouteservice/blob/393a4bfa7ec1bcecfa1e4b21a4a42bf0de6b5bf7/openrouteservice/src/main/resources/ors-config-sample.json#L69-L74

HendrikLeuschner commented 2 years ago

Got to check that out. Memory requirements should not be this big for fast isochrones.

nilsnolde commented 2 years ago

fyi, this was my config (just overlooked the fast-isochrones stuff) on a few weeks old europe extract, built with docker:

config
{
  "ors": {
    "info": {
      "base_url": "https://openrouteservice.org/",
      "support_mail": "support@openrouteservice.org",
      "author_tag": "openrouteservice",
      "content_licence": "LGPL 3.0"
    },
    "services": {
      "matrix": {
        "enabled": true,
        "maximum_routes": 10000000,
        "maximum_routes_flexible": 2500,
        "maximum_search_radius": 5000,
        "maximum_visited_nodes": 1000000,
        "allow_resolve_locations": true,
        "attribution": "openrouteservice.org, OpenStreetMap contributors"
      },
      "isochrones": {
        "enabled": true,
        "maximum_range_distance": [
          {
            "profiles": "any",
            "value": 50000
          },
          {
            "profiles": "driving-car, driving-hgv",
            "value": 100000
          }
        ],
        "maximum_range_time": [
          {
            "profiles": "any",
            "value": 18000
          },
          {
            "profiles": "driving-car, driving-hgv",
            "value": 3600
          }
        ],
        "fastisochrones": {
          "maximum_range_distance": [
            {
              "profiles": "any",
              "value": 50000
            },
            {
              "profiles": "driving-car, driving-hgv",
              "value": 500000
            }
          ],
          "maximum_range_time": [
            {
              "profiles": "any",
              "value": 18000
            },
            {
              "profiles": "driving-car, driving-hgv",
              "value": 10800
            }
          ],
          "profiles": {
            "default_params": {
              "enabled": false,
              "threads": 12,
              "weightings": "recommended",
              "maxcellnodes": 5000
            },
            "profile-hgv": {
              "enabled": true,
              "threads": 12,
              "weightings": "recommended, shortest",
              "maxcellnodes": 5000
            }
          }
        },
        "maximum_intervals": 10,
        "maximum_locations": 2,
        "allow_compute_area": true
      },
      "routing": {
        "enabled": true,
        "mode": "normal",
        "routing_description": "This is a routing file from openrouteservice",
        "routing_name": "openrouteservice routing",
        "sources": [
          "/ors-core/data/osm_file.pbf"
        ],
        "init_threads": 1,
        "attribution": "openrouteservice.org, OpenStreetMap contributors",
        "elevation_preprocessed": false,
        "profiles": {
          "active": [
            "car",
            "hgv"
          ],
          "default_params": {
            "encoder_flags_size": 8,
            "graphs_root_path": "/ors-core/data/graphs",
            "elevation": false,
            "elevation_provider": "multi",
            "elevation_cache_path": "/ors-core/data/elevation_cache",
            "elevation_cache_clear": false,
            "instructions": true,
            "maximum_distance": 100000,
            "maximum_distance_dynamic_weights": 100000,
            "maximum_distance_avoid_areas": 100000,
            "maximum_waypoints": 50,
            "maximum_snapping_radius": 400,
            "maximum_avoid_polygon_area": 200000000,
            "maximum_avoid_polygon_extent": 20000,
            "maximum_distance_alternative_routes": 100000,
            "maximum_alternative_routes": 3,
            "maximum_distance_round_trip_routes": 100000,
            "maximum_speed_lower_bound": 80,
            "preparation": {
              "min_network_size": 200,
              "min_one_way_network_size": 200,
              "methods": {
                "lm": {
                  "enabled": false,
                  "threads": 1,
                  "weightings": "recommended,shortest",
                  "landmarks": 16
                }
              }
            },
            "execution": {
              "methods": {
                "lm": {
                  "disabling_allowed": true,
                  "active_landmarks": 8
                }
              }
            }
          },
          "profile-car": {
            "profiles": "driving-car",
            "parameters": {
              "encoder_flags_size": 8,
              "encoder_options": "turn_costs=true|block_fords=false|use_acceleration=true",
              "maximum_distance": 1000000,
              "elevation": false,
              "maximum_snapping_radius": 1000,
              "preparation": {
                "min_network_size": 200,
                "min_one_way_network_size": 200,
                "methods": {
                  "ch": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "fastest"
                  },
                  "lm": {
                    "enabled": false,
                    "threads": 1,
                    "weightings": "fastest,shortest",
                    "landmarks": 16
                  },
                  "core": {
                    "enabled": false,
                    "threads": 1,
                    "weightings": "fastest,shortest",
                    "landmarks": 64,
                    "lmsets": "highways;allow_all"
                  }
                }
              },
              "execution": {
                "methods": {
                  "ch": {
                    "disabling_allowed": true
                  },
                  "lm": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  },
                  "core": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  }
                }
              },
              "ext_storages": {
                "WayCategory": {},
                "HeavyVehicle": {},
                "WaySurfaceType": {},
                "RoadAccessRestrictions": {
                  "use_for_warnings": true
                }
              }
            }
          },
          "profile-hgv": {
            "profiles": "driving-hgv",
            "parameters": {
              "encoder_flags_size": 8,
              "encoder_options": "turn_costs=true|block_fords=false|use_acceleration=true",
              "maximum_distance": 100000,
              "elevation": false,
              "preparation": {
                "min_network_size": 200,
                "min_one_way_network_size": 200,
                "methods": {
                  "ch": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "recommended"
                  },
                  "lm": {
                    "enabled": false,
                    "threads": 1,
                    "weightings": "fastest,shortest",
                    "landmarks": 16
                  },
                  "core": {
                    "enabled": false,
                    "threads": 1,
                    "weightings": "recommended,shortest",
                    "landmarks": 64,
                    "lmsets": "highways;allow_all"
                  }
                }
              },
              "execution": {
                "methods": {
                  "ch": {
                    "disabling_allowed": true
                  },
                  "core": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  }
                }
              },
              "ext_storages": {
                "WayCategory": {},
                "HeavyVehicle": {
                  "restrictions": true
                },
                "WaySurfaceType": {}
              }
            }
          }
        }
      }
    },
    "logging": {
      "enabled": true,
      "level_file": "DEBUG_LOGGING.json",
      "location": "/var/log/ors",
      "stdout": true
    },
    "system_message": [
      {
        "active": false,
        "text": "This message would be sent with every routing bike fastest request",
        "condition": {
          "request_service": "routing",
          "request_profile": "cycling-regular,cycling-mountain,cycling-road,cycling-electric",
          "request_preference": "fastest"
        }
      },
      {
        "active": false,
        "text": "This message would be sent with every request for geojson response",
        "condition": {
          "api_format": "geojson"
        }
      },
      {
        "active": false,
        "text": "This message would be sent with every request on API v1 from January 2020 until June 2050",
        "condition": {
          "api_version": 1,
          "time_after": "2020-01-01T00:00:00Z",
          "time_before": "2050-06-01T00:00:00Z"
        }
      },
      {
        "active": false,
        "text": "This message would be sent with every request"
      }
    ]
  }
}

EDIT: and the generated files:

-rwxrwxrwx 1 root root  155M Oct 21 21:55 bordernodes_fastest_heavyvehicle*
-rwxrwxrwx 1 root root  155M Oct 21 23:14 bordernodes_shortest_heavyvehicle*
-rwxrwxrwx 1 root root  635M Oct 21 20:30 cells*
-rwxrwxrwx 1 root root   11M Oct 21 21:20 eccentricities_fastest_heavyvehicle*
-rwxrwxrwx 1 root root   11M Oct 21 22:42 eccentricities_shortest_heavyvehicle*
-rwxrwxrwx 1 root root  3.4G Oct 21 23:14 edges*
-rwxrwxrwx 1 root root 1017M Oct 21 23:14 ext_hgv*
-rwxrwxrwx 1 root root   86M Oct 21 23:14 ext_waycategory*
-rwxrwxrwx 1 root root   86M Oct 21 23:14 ext_waysurface*
-rwxrwxrwx 1 root root  2.2G Oct 21 23:14 geometry*
-rwxrwxrwx 1 root root  335M Oct 21 20:05 isochronenodes*
-rwxrwxrwx 1 root root  408M Oct 21 15:34 location_index*
-rwxrwxrwx 1 root root  253M Oct 21 23:14 names*
-rwxrwxrwx 1 root root  1.1G Oct 21 23:14 nodes*
-rwxrwxrwx 1 root root  535M Oct 21 23:14 nodes_ch_recommended_heavyvehicle_node*
-rwxrwxrwx 1 root root   33K Oct 21 23:14 properties*
-rwxrwxrwx 1 root root  1.4G Oct 21 23:14 shortcuts_ch_recommended_heavyvehicle_node*
-rwxrwxrwx 1 root root    11 Oct 21 23:14 stamp.txt*
-rwxrwxrwx 1 root root   12M Oct 21 23:14 turn_costs*

and the logs:

21 Oct 23:14:40 INFO [routing.RoutingProfileManager] - Total time: 37053.971s.
21 Oct 23:14:40 INFO [routing.RoutingProfileManager] - ========================================================================
21 Oct 23:14:40 INFO [routing.RoutingProfileManager] - ====> Recycling garbage...
21 Oct 23:14:40 INFO [routing.RoutingProfileManager] - Before:  Total - 58 GB, Free - 6.62 GB, Max: 58 GB, Used - 51.38 GB
21 Oct 23:14:42 INFO [routing.RoutingProfileManager] - After:  Total - 58 GB, Free - 35.27 GB, Max: 58 GB, Used - 22.73 GB
21 Oct 23:14:42 INFO [routing.RoutingProfileManager] - ========================================================================
21 Oct 23:14:42 INFO [routing.RoutingProfileManager] - ====> Memory usage by profiles:
21 Oct 23:14:42 INFO [routing.RoutingProfileManager] - [1] 11.96 GB (52.6%)
21 Oct 23:14:42 INFO [routing.RoutingProfileManager] - [2] 10.98 GB (48.3%)
21 Oct 23:14:42 INFO [routing.RoutingProfileManager] - Total: 22.93 GB (100.9%)
21 Oct 23:14:42 INFO [routing.RoutingProfileManager] - ========================================================================
HendrikLeuschner commented 2 years ago

Mem consumption is quite high during processing time, but significantly lower afterwards. High processing consumption is expected, but this is extreme. Will check again what is happening here.

HendrikLeuschner commented 2 years ago

Needs some investigation still. Disabling by default independently of investigation