Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generation of inefficient MLD partitions #6085

Merged
merged 1 commit into from
Sep 3, 2021

Conversation

mjjbell
Copy link
Member

@mjjbell mjjbell commented Jul 17, 2021

Issue

See #6084 for details

Performance

This has measurable improvement on MLD routing.
Will include test results in comments below.
TL;DR

  • /table is ~6% faster
  • /route is ~3% faster
  • osrm-routed uses 0.2% less memory

Tasklist

Requirements / Relations

Closes #6084

@mjjbell
Copy link
Member Author

mjjbell commented Jul 20, 2021

Performance Analysis

Preparation

Using the same set up as the analysis for 5953.

Test coordinate sets 1-4 are used to run the following requests via libosrm:

  • Route
  • Table

Tests are performed using libosrm versions of Project-OSRM:master at commit f7478ba and mjjbell:mbell/fix_partition

Results - Route

All weights returned by route requests were identical between the two versions, confirming that this is an efficiency issue and not one of correctness. The results below show the difference in request time for the coordinate sets.

Coordinate set 1

Request Duration

_route - coordinate set #1

Percentile master (ms) fix_partition (ms) diff (ms) % diff
0 0.154471 0.152201 -0.00227 -1.47%
10 2.669106 2.616134 -0.052972 -1.98%
20 3.751663 3.680158 -0.071505 -1.91%
30 4.734963 4.619953 -0.11501 -2.43%
40 5.62314 5.46207 -0.16107 -2.86%
50 6.453918 6.252365 -0.201553 -3.12%
60 7.21085 6.980903 -0.229947 -3.19%
70 7.941261 7.692172 -0.249089 -3.14%
80 8.80241 8.506741 -0.295669 -3.36%
90 9.896545 9.589235 -0.30731 -3.11%
99 12.116957 11.74409 -0.372867 -3.08%
100 18.28257 16.695946 -1.586624 -8.68%

Coordinate set 2

Request Duration

_route - coordinate set #2

Percentile master (ms) fix_partition (ms) diff (ms) % diff
0 0.25693 0.260137 0.003207 1.25%
10 2.556038 2.536922 -0.019116 -0.75%
20 3.639011 3.589652 -0.049359 -1.36%
30 4.6078 4.535094 -0.072706 -1.58%
40 5.461024 5.361781 -0.099243 -1.82%
50 6.264203 6.119925 -0.144278 -2.30%
60 7.020015 6.85391 -0.166105 -2.37%
70 7.738702 7.540901 -0.197801 -2.56%
80 8.556407 8.337487 -0.21892 -2.56%
90 9.613988 9.360396 -0.253592 -2.64%
99 11.793081 11.538348 -0.254733 -2.16%
100 24.799571 22.817134 -1.982437 -7.99%

Coordinate set 3

Request Duration

_route - coordinate set #3

Percentile master (ms) fix_partition (ms) diff (ms) % diff
0 19.437048 18.797734 -0.639314 -3.29%
10 71.025059 69.272798 -1.752261 -2.47%
20 77.059782 75.238085 -1.821697 -2.36%
30 81.598722 79.593407 -2.005315 -2.46%
40 85.695252 83.621487 -2.073765 -2.42%
50 89.373398 87.294284 -2.079114 -2.33%
60 93.097106 90.985695 -2.111411 -2.27%
70 97.272864 95.14395 -2.128914 -2.19%
80 102.285712 100.152031 -2.133681 -2.09%
90 108.786855 107.255586 -1.531269 -1.41%
99 125.305563 129.558019 4.252456 3.39%
100 151.156645 172.255205 21.09856 13.96%

Coordinate set 4

Request Duration

_route - coordinate set #4

Percentile master (ms) fix_partition (ms) diff (ms) % diff
0 25.913241 24.23784 -1.675401 -6.47%
10 814.464086 787.417538 -27.046548 -3.32%
20 836.353983 809.014586 -27.339397 -3.27%
30 851.785444 823.792733 -27.992711 -3.29%
40 865.104352 836.715815 -28.388537 -3.28%
50 878.115884 849.180154 -28.93573 -3.30%
60 890.952671 861.678646 -29.274025 -3.29%
70 904.132357 874.764135 -29.368222 -3.25%
80 919.708454 890.934476 -28.773978 -3.13%
90 941.874249 912.595046 -29.279203 -3.11%
99 997.582008 968.170331 -29.411677 -2.95%
100 1219.311902 1778.331622 559.01972 45.85%

Results - Table

We are not able to compare route weights, as the table response does not contain them. Instead we compare route durations.
Durations were identical in all results for both versions, so we once again only show response time comparisons.

Coordinate set 1

Request Duration

_table - coordinate set #1

Percentile master (ms) fix_partition (ms) diff (ms) % diff
0 8.52231 8.12744 -0.39487 -4.63%
10 10.6262 9.99112 -0.63508 -5.98%
20 11.2003 10.5592 -0.6411 -5.72%
30 11.7169 11.0568 -0.6601 -5.63%
40 12.1714 11.566 -0.6054 -4.97%
50 12.6494 12.0666 -0.5828 -4.61%
60 13.2236 12.6635 -0.5601 -4.24%
70 13.8445 13.2564 -0.5881 -4.25%
80 14.445 13.8405 -0.6045 -4.18%
90 15.4362 14.824 -0.6122 -3.97%
99 17.479 16.8394 -0.6396 -3.66%
100 20.9141 43.4808 22.5667 107.90%

Coordinate set 2

Request Duration

_table - coordinate set #2

Percentile master (ms) fix_partition (ms) diff (ms) % diff
0 8.39358 8.32601 -0.06757 -0.81%
10 10.9476 10.1802 -0.7674 -7.01%
20 11.5506 10.7327 -0.8179 -7.08%
30 12.0481 11.2383 -0.8098 -6.72%
40 12.511 11.6994 -0.8116 -6.49%
50 13.0715 12.2619 -0.8096 -6.19%
60 13.7215 12.9237 -0.7978 -5.81%
70 14.3289 13.5006 -0.8283 -5.78%
80 14.9963 14.1119 -0.8844 -5.90%
90 15.9704 15.0685 -0.9019 -5.65%
99 18.108 17.1151 -0.9929 -5.48%
100 23.96 22.2749 -1.6851 -7.03%

Coordinate set 3

Request Duration

_table - coordinate set #3

Percentile master (ms) fix_partition (ms) diff (ms) % diff
0 58.6765 57.8506 -0.8259 -1.41%
10 71.1164 66.6914 -4.425 -6.22%
20 73.0706 68.5708 -4.4998 -6.16%
30 74.5502 69.9428 -4.6074 -6.18%
40 75.7452 71.0704 -4.6748 -6.17%
50 76.9461 72.1287 -4.8174 -6.26%
60 78.1633 73.2447 -4.9186 -6.29%
70 79.5063 74.447 -5.0593 -6.36%
80 81.1562 75.9182 -5.238 -6.45%
90 83.6164 77.9885 -5.6279 -6.73%
99 118.996 82.8386 -36.1574 -30.39%
100 137.67 124.055 -13.615 -9.89%

Coordinate set 4

Request Duration

table - coordinate set #4

Percentile master (ms) fix_partition (ms) diff (ms) % diff
0 662.771 656.752 -6.019 -0.91%
10 737.114 688.1 -49.014 -6.65%
20 744.452 695.028 -49.424 -6.64%
30 749.834 700.153 -49.681 -6.63%
40 755.146 705.125 -50.021 -6.62%
50 760.206 710.15 -50.056 -6.58%
60 765.999 715.63 -50.369 -6.58%
70 774.375 722.935 -51.44 -6.64%
80 789.977 737.779 -52.198 -6.61%
90 805.693 754.895 -50.798 -6.30%
99 829.906 780.046 -49.86 -6.01%
100 1017.64 942.108 -75.532 -7.42%

Results - File Size

file master (bytes) fix_partition (bytes) % diff
germany-latest.osrm.timestamp 3584 3584 0.00%
germany-latest.osrm.names 10784768 10784768 0.00%
germany-latest.osrm.properties 6144 6144 0.00%
germany-latest.osrm 1643998720 1643998208 0.00%
germany-latest.osrm.nbg_nodes 390235136 390235136 0.00%
germany-latest.osrm.cnbg 164078592 164078592 0.00%
germany-latest.osrm.restrictions 4096 4096 0.00%
germany-latest.osrm.turn_weight_penalties 72300544 72300544 0.00%
germany-latest.osrm.turn_duration_penalties 72300544 72300544 0.00%
germany-latest.osrm.turn_penalties_index 433782784 433782784 0.00%
germany-latest.osrm.icd 127657472 127657472 0.00%
germany-latest.osrm.tld 9728 9728 0.00%
germany-latest.osrm.tls 18432 18432 0.00%
germany-latest.osrm.edges 253051904 253051904 0.00%
germany-latest.osrm.geometry 784014336 784014336 0.00%
germany-latest.osrm.ramIndex 2663936 2663936 0.00%
germany-latest.osrm.cnbg_to_ebg 164078592 164118528 0.02%
germany-latest.osrm.fileIndex 667178080 667178080 0.00%
germany-latest.osrm.ebg_nodes 243012608 243012608 0.00%
germany-latest.osrm.enw 237754880 237754880 0.00%
germany-latest.osrm.maneuver_overrides 5120 5120 0.00%
germany-latest.osrm.partition 158537216 158537216 0.00%
germany-latest.osrm.cells 13820928 13813248 -0.06%
germany-latest.osrm.ebg 867566080 867565568 0.00%
germany-latest.osrm.datasource_names 69632 69632 0.00%
germany-latest.osrm.cell_metrics 1231961088 1221442560 -0.85%
germany-latest.osrm.mldgr 920420352 920420864 0.00%
Total 8459315296 8448828512 -0.12%
osrm-routed total 4948051552 4937525856 -0.21%

Copy link
Member

@TheMarex TheMarex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find. 👍

@mjjbell mjjbell force-pushed the mbell/fix_partition branch 2 times, most recently from 565aa70 to 3d694b3 Compare August 29, 2021 13:14
Duplicate restriction nodes in the edge-based-graph are currently
not in included in a mapping (.osrm.cnbg_to_ebg) from
node-based-graph edges to edge-based-graph nodes.
This mapping is used by the MLD partitioner to assign EBG nodes
to partitions.

The omission from the mapping means all restriction nodes are
included in a special 'invalid' partition. This special partition
will break the geolocation properties of the multi-level hierarchy.
The partition and its super levels will have a large number of
border nodes and very few internal paths between them.

Given the partitioner is the only consumer of the mapping, we fix
the issue by including the duplicate restriction nodes in the mapping,
so that they are correctly assigned to a partition.

This has measurable improvement on MLD routing.
For a country-sized routing network, the fix reduces routing and table
request computation time by ~2% and ~6% respectively.
@mjjbell mjjbell force-pushed the mbell/fix_partition branch from 3d694b3 to b4cc11b Compare September 3, 2021 21:12
@mjjbell mjjbell merged commit 9884684 into Project-OSRM:master Sep 3, 2021
@mjjbell mjjbell deleted the mbell/fix_partition branch September 3, 2021 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generation of inefficient MLD partitions
2 participants