Skip to content

Update traffic data without relaunching the web server "osrm-routed" #5703

@abdelhakimbendjabeur

Description

@abdelhakimbendjabeur

Hello,

I am experimenting on osrm locally using docker and I have been trying to customize the graph using custom segment speed files. I only see the effect of my speed when I relaunch the osrm-routed.

Here are the commands I used

wget http://download.geofabrik.de/europe/france/ile-de-france-latest.osm.pbf

docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-extract -p /opt/car.lua /data/ile-de-france-latest.osm.pbf

docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-partition /data/ile-de-france-latest.osrm

docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-customize /data/ile-de-france-latest.osrm

docker run -d -t -i -p 1000:5000 -v "${PWD}:/data" osrm/osrm-backend osrm-routed --algorithm mld /data/ile-de-france-latest.osrm
>>> <container-id>

and now I have a working web server on localhost:1000

Next I do is just get copy the speed file inside the container <container-id> and run the following

// My terminal
docker cp ~/Desktop/speedfile.csv <container-id>:/tmp

// Inside the container
root@79fc04d4079f:/opt# osrm-customize /data/ile-de-france-latest.osrm --segment-speed-file /tmp/speed_file.csv

log output

[info] Loaded /tmp/speed_file.csv with 16values
[info] In total loaded 1 file(s) with a total of 16 unique values
[info] Used 3504488 speeds from LUA profile or input map
[info] Used 16 speeds from /tmp/speed_file.csv
[warn] Speed values were used to update 16 segments for 'routability' profile
[info] Updating segment data took 412.522ms.
[info] In total loaded 0 file(s) with a total of 0 unique values
[info] Done reading edges in 2638.76ms.
[info] Loaded edge based graph: 3342718 edges, 936893 nodes
[info] Loading partition data took 3.77922 seconds
[info] Cells customization took 6.5012 seconds
[info] Cells statistics per level
[info] Level 1 #cells 5050 #boundary nodes 93417, sources: avg. 11, destinations: avg. 16, entries: 1171113 (9368904 bytes)
[info] Level 2 #cells 346 #boundary nodes 14907, sources: avg. 27, destinations: avg. 36, entries: 417244 (3337952 bytes)
[info] Level 3 #cells 21 #boundary nodes 2264, sources: avg. 68, destinations: avg. 86, entries: 154492 (1235936 bytes)
[info] Level 4 #cells 1 #boundary nodes 0, sources: avg. 0, destinations: avg. 0, entries: 0 (0 bytes)
[info] Unreachable nodes statistics per level
[warn] Level 1 unreachable boundary nodes per cell: 0.00475248 sources, 0.00336634 destinations
[warn] Level 2 unreachable boundary nodes per cell: 0.017341 sources, 0.00578035 destinations
[warn] Level 3 unreachable boundary nodes per cell: 0.0952381 sources, 0 destinations
[info] Unreachable nodes statistics per level
[warn] Level 1 unreachable boundary nodes per cell: 0.0255446 sources, 0.020396 destinations
[warn] Level 2 unreachable boundary nodes per cell: 0.147399 sources, 0.118497 destinations
[warn] Level 3 unreachable boundary nodes per cell: 0.571429 sources, 0.47619 destinations
[info] Unreachable nodes statistics per level
[warn] Level 1 unreachable boundary nodes per cell: 0.145347 sources, 0.0972277 destinations
[warn] Level 2 unreachable boundary nodes per cell: 1.10983 sources, 0.713873 destinations
[warn] Level 3 unreachable boundary nodes per cell: 5.28571 sources, 3.14286 destinations
[info] Unreachable nodes statistics per level
[warn] Level 1 unreachable boundary nodes per cell: 0.00475248 sources, 0.00336634 destinations
[warn] Level 2 unreachable boundary nodes per cell: 0.017341 sources, 0.00578035 destinations
[warn] Level 3 unreachable boundary nodes per cell: 0.0952381 sources, 0 destinations
[info] MLD customization writing took 0.97205 seconds
[info] Graph writing took 0.920148 seconds
[info] RAM: peak bytes used: 283684864

Now when I make requests to the /route/v1/driving/ endpoint, the speed file does not seem to be taken into account.
But when I kill the container and recreate one, then the speed is taken into account and I have the ETAs as expected.

  • How can I customize the graph using a segment speed file and observe the change without having to create a new osrm-routed container?
    (i.e. Is there a way of applying the speed file without having to recreate the container?)

  • side question: How recommended is this usage in production?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions