Playing with some JAVA_OPTS and moving to latest JDK 11 did not help. However in the meantime I discovered that when performance is bad, if I continue to stress the system the performance starts improving and goes back to original (i.e. I don’t have to stop/restart graphhopper). I’m wandering if this is related to my VPS hosting that reduces VM resources when idle for some time - which I’m sure happens since I’m the sole user. I installed a simple benchmark tool (sysbench) but I can’t seem to find a real proof of what I am saying - although you may find several complains around VPS slowness after being idle for a while.
While continuing my investigation on the VPS itself, here are GH logs for the very same route.
this took about 0.2 secs:
INFO [2018-11-08 07:47:37,622] com.graphhopper.resources.RouteResource: point=44.071800%2C10.371090&point=44.933700%2C11.733400&point=45.151050%2C10.832520&point=45.752730%2C9.799300&point=45.244370%2C8.723300&point=44.762340%2C8.833010&point=44.402390%2C9.646000&elevation=false&locale=en-US&use_miles=false&weighting=fastest&vehicle=car& 127.0.0.1 it_IT Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0 [44.0718,10.37109, 44.9337,11.7334, 45.15105,10.83252, 45.75273,9.7993, 45.24437,8.7233, 44.76234,8.83301, 44.40239,9.646], took:0.029609261, , fastest, car, alternatives: 1, distance0: 836413.6882393945, weight0: 37016.722285222844, time0: 617min, points0: 6659, debugInfo: idLookup:0.001535803s; , algoInit:1.15249E-4s, dijkstrabi|ch-routing:0.002127511s, extract time:5.15389E-4;visited nodes sum: 387;, algoInit:2.39574E-4s, dijkstrabi|ch-routing:0.001386596s, extract time:3.4599E-4;visited nodes sum: 657;, algoInit:8.567E-5s, dijkstrabi|ch-routing:0.001539026s, extract time:1.79684E-4;visited nodes sum: 987;, algoInit:8.0259E-5s, dijkstrabi|ch-routing:0.001627627s, extract time:3.40914E-4;visited nodes sum: 1309;, algoInit:8.1002E-5s, dijkstrabi|ch-routing:9.26019E-4s, extract time:1.82918E-4;visited nodes sum: 1503;, algoInit:7.6826E-5s, dijkstrabi|ch-routing:0.001187071s, extract time:3.34244E-4;visited nodes sum: 1809;, algoInit:1.15249E-4s, dijkstrabi|ch-routing:0.002127511s, extract time:5.15389E-4;visited nodes sum: 387;, algoInit:2.39574E-4s, dijkstrabi|ch-routing:0.001386596s, extract time:3.4599E-4;visited nodes sum: 657;, algoInit:8.567E-5s, dijkstrabi|ch-routing:0.001539026s, extract time:1.79684E-4;visited nodes sum: 987;, algoInit:8.0259E-5s, dijkstrabi|ch-routing:0.001627627s, extract time:3.40914E-4;visited nodes sum: 1309;, algoInit:8.1002E-5s, dijkstrabi|ch-routing:9.26019E-4s, extract time:1.82918E-4;visited nodes sum: 1503;, algoInit:7.6826E-5s, dijkstrabi|ch-routing:0.001187071s, extract time:3.34244E-4;visited nodes sum: 1809, simplify (9097->9097)
Very same route a few hours later, 1.3 secs:
INFO [2018-11-08 17:09:27,862] com.graphhopper.resources.RouteResource: point=44.071800%2C10.371090&point=44.933700%2C11.733400&point=45.151050%2C10.832520&point=45.752730%2C9.799300&point=45.244370%2C8.723300&point=44.762340%2C8.833010&point=44.402390%2C9.646000&elevation=false&locale=en-US&use_miles=false&weighting=fastest&vehicle=car& 127.0.0.1 en_US Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0 [44.0718,10.37109, 44.9337,11.7334, 45.15105,10.83252, 45.75273,9.7993, 45.24437,8.7233, 44.76234,8.83301, 44.40239,9.646], took:1.0017631, , fastest, car, alternatives: 1, distance0: 836413.6882393945, weight0: 37016.722285222844, time0: 617min, points0: 6659, debugInfo: idLookup:0.0682984s; , algoInit:0.009989078s, dijkstrabi|ch-routing:0.028843064s, extract time:0.019230144;visited nodes sum: 387;, algoInit:0.012513436s, dijkstrabi|ch-routing:0.02119674s, extract time:0.016239831;visited nodes sum: 657;, algoInit:0.01274486s, dijkstrabi|ch-routing:0.014257008s, extract time:0.00810288;visited nodes sum: 987;, algoInit:0.020222537s, dijkstrabi|ch-routing:0.012229018s, extract time:0.008115922;visited nodes sum: 1309;, algoInit:0.008919194s, dijkstrabi|ch-routing:0.017351024s, extract time:0.010871838;visited nodes sum: 1503;, algoInit:0.00816546s, dijkstrabi|ch-routing:0.020060647s, extract time:0.016663527;visited nodes sum: 1809;, algoInit:0.009989078s, dijkstrabi|ch-routing:0.028843064s, extract time:0.019230144;visited nodes sum: 387;, algoInit:0.012513436s, dijkstrabi|ch-routing:0.02119674s, extract time:0.016239831;visited nodes sum: 657;, algoInit:0.01274486s, dijkstrabi|ch-routing:0.014257008s, extract time:0.00810288;visited nodes sum: 987;, algoInit:0.020222537s, dijkstrabi|ch-routing:0.012229018s, extract time:0.008115922;visited nodes sum: 1309;, algoInit:0.008919194s, dijkstrabi|ch-routing:0.017351024s, extract time:0.010871838;visited nodes sum: 1503;, algoInit:0.00816546s, dijkstrabi|ch-routing:0.020060647s, extract time:0.016663527;visited nodes sum: 1809, simplify (9097->9097)
It really seems each step is much slower… however sysbench cpu/memory tests reports similar figures - but maybe I’m not benchmarking the right thing here (any suggestion on which benchmark to run is appreciated). Note that a few minutes after the second (and then several others) attempt performance went back to the expected one.