You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Potential Improvement: Introduce max Request Time in the Backend #636
This is already done on the jetty side (we can configure it somewhere I think). Also we should do this within GraphHopper itself: #473
The current solution via maximum weight is already working but not suitable if the weighting is not seconds nor meters.
Also see potential performance improvements if not using CH #506
I guess a nice solution would monitor all requests and check if one request ran longer than allowed. This could keep the performance overhead rather small.
But limiting the request duration should be possible with jetty, not sure if it kills the thread then but if this is available from jetty I woud not want to implement this. Of course making this easily configurable should be our aim
I just tried setting setMaxIdleTime (also soLingerTime and stopTimeout) but none worked as expected. I will keep you updated if I find a good solution.
Yes. I was just looking for a prevention. This created some headaches for me in the last days including several GraphHopper restarts. So i figured, something like that would be nice.
took:169.19841 is a lot less as to what I actually observed for the entire request and all the while, GH sucked up some considerable CPU - which to me is a clear indicator that I have to worry about this, especially on a smaller server.
Of course an AJAX request would time out long before, but the calculation on the server is still continuing (and possibly heaping up, since a user might click again and again...)
So I still think a maxVisitedNodes threshold parameter would also make sense for CH routing, i.e. stop and throw a respective exception rather than continuing long after a client timeout.
much faster now (?!), but according to the simplify info, maxVisitedNodes wasn't taken into account?
Should work on 0.6 I think but not 100% sure. Maybe you go to the master and use routing.max_visited_nodes? You'll see an exception if the setting protects you...
Maybe we should set maxVisitedNodes to some limited value already in the config?
This won't affect CH but keeps non-CH safer.
Here I meant that one default setting like 1mio would not make CH safer at the same time as there you have just a few K nodes.
on 0.6 it should be routing.maxVisitedNodes. Also have a look into the json response, there you see how many visited nodes you have and can just use a bit lower value (restart necessary) to see if it throws an exception.
Ok, this does work in the master branch (java.lang.IllegalArgumentException: No path found due to maximum nodes exceeded...) with routing.max_visited_nodes but I get no such exception when setting routing.maxVisitedNodes in 0.6
That's fine, I also spent almost half the day yesterday to prevent routing in case line of sight dist > some max value on the client side (which will not be entirely in vain once I have 0.7 since it also now properly cancels waypoint drags etc.)
We have been running into memory and performance issues related to this issue.
At scale, we set a large value for maxVisitedNodes to enable routing against sparse data set.
Are there any improvements planned to map matching to detect cyclical graph traversal and prevent infinite loop without having to rely on maxVisitedNodes? It seems that an edge should not be traversed more than once or have a way to configure the number of re-traversals allowed.
Activity
karussell commentedon Jan 9, 2016
This is already done on the jetty side (we can configure it somewhere I think). Also we should do this within GraphHopper itself: #473
The current solution via maximum weight is already working but not suitable if the weighting is not seconds nor meters.
Also see potential performance improvements if not using CH #506
boldtrn commentedon Jan 9, 2016
I guess a nice solution would monitor all requests and check if one request ran longer than allowed. This could keep the performance overhead rather small.
The default seems to have no time out set.
karussell commentedon Jan 9, 2016
But limiting the request duration should be possible with jetty, not sure if it kills the thread then but if this is available from jetty I woud not want to implement this. Of course making this easily configurable should be our aim
boldtrn commentedon Jan 11, 2016
Thanks, you are right. I misunderstood your last post. I did a quick research but could not come up with an easy solution. The best I found was:
Include the
setMaxIdleTimein theGHServerand make it configureable in the config file. But I am not sure if this setting is doing the trick.karussell commentedon Jan 11, 2016
Yes, this looks good.
Why not try it ;) ? They say in the docs that this is highly likely delegated to the JVM via setSoTimeout
BTW: another param was also requested and we can make it configurable as well:
connector0.setAcceptQueueSize();boldtrn commentedon Jan 11, 2016
I might some day, but not today. BTW: I guess this would be a good first issue ;).
boldtrn commentedon Apr 15, 2016
I just tried setting
setMaxIdleTime(alsosoLingerTimeandstopTimeout) but none worked as expected. I will keep you updated if I find a good solution.karussell commentedon Apr 15, 2016
Will maxVisitedNode not work for your use case?
boldtrn commentedon Apr 15, 2016
No I introduced an endless loop for some rare scenarios (which is already fixed). Due to this I revisited this issue.
karussell commentedon Apr 15, 2016
But once the endless loop is fixed the maxVisitedNodes can be used? Or why can't you use it?
boldtrn commentedon Apr 15, 2016
Yes. I was just looking for a prevention. This created some headaches for me in the last days including several GraphHopper restarts. So i figured, something like that would be nice.
19 remaining items
arminus commentedon Jun 5, 2016
Well, I have CH enabled and still need to protect the server against paris to nyc like routing attempts
karussell commentedon Jun 6, 2016
This should not be a problem with CH although you can still protect it but the benefit would be a lot lower
arminus commentedon Jun 6, 2016
My "blackbox-observation" doesn't quite confirm this... I just ran a test using a rather powerful server with a GH database covering D/A/CH/I, with
->
2016-06-06 15:23:43,486 [qtp131682780-17] INFO com.graphhopper.http.GHBaseServlet - vehicle=foot&weighting=shortest&point=53.56641415275043,10.01953125&point=38.75408327579141,16.5234375&instructions=true&type=json&key=undefined 127.0.0.1 de_DE Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0 [53.56641415275043,10.01953125, 38.75408327579141,16.5234375], took:169.19841, , shortest, foot, alternatives: 1, distance0: 2039668.5970157352, time0: 24675min, points0: 27934, debugInfo: idLookup:4.2552485s; , algoInit:0.06761164s, dijkstrabiCH-routing:129.13196s, extract time:36.1786;, algoInit:0.06761164s, dijkstrabiCH-routing:129.13196s, extract time:36.1786, simplify (39272->27934)took:169.19841 is a lot less as to what I actually observed for the entire request and all the while, GH sucked up some considerable CPU - which to me is a clear indicator that I have to worry about this, especially on a smaller server.
Of course an AJAX request would time out long before, but the calculation on the server is still continuing (and possibly heaping up, since a user might click again and again...)
So I still think a maxVisitedNodes threshold parameter would also make sense for CH routing, i.e. stop and throw a respective exception rather than continuing long after a client timeout.
karussell commentedon Jun 6, 2016
You are using MMAP and have probably only a few available RAM (?). Then yes, you would also need such a protection. I meant the defaults (RAM+CH=true)
The current maxVisitedNodes should influence CH too, if not raise an issue as this would be a bug
karussell commentedon Jun 6, 2016
BTW: If you have a powerful server, then do NOT use MMAP!
arminus commentedon Jun 6, 2016
on the production server, yes
Your last comment On April 29 indicated otherwise, but ok, I just reran the test, with
routing.maxVisitedNodes=2000Just restarted the server, didn't rebuild the DB, though, do I need to? (that'll take some 24hours...)
->
2016-06-06 15:51:43,633 [qtp131682780-16] INFO com.graphhopper.http.GHBaseServlet - vehicle=foot&weighting=shortest&point=53.56641415275043,9.931640625&point=38.85682013474361,16.6552734375&instructions=true&type=json&key=undefined 127.0.0.1 de_DE Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0 [53.56641415275043,9.931640625, 38.85682013474361,16.6552734375], took:2.7777863, , shortest, foot, alternatives: 1, distance0: 2048202.6742501908, time0: 24777min, points0: 28002, debugInfo: idLookup:0.7286473s; , algoInit:0.017141698s, dijkstrabiCH-routing:1.1349596s, extract time:0.56115097;, algoInit:0.017141698s, dijkstrabiCH-routing:1.1349596s, extract time:0.56115097, simplify (39533->28002)much faster now (?!), but according to the simplify info, maxVisitedNodes wasn't taken into account?
Understood, I only run the tests on the server where I build the GH database, not on the smaller server where I deploy it...
arminus commentedon Jun 6, 2016
BTW: I'm on GH 0.6
karussell commentedon Jun 6, 2016
Should work on 0.6 I think but not 100% sure. Maybe you go to the master and use
routing.max_visited_nodes? You'll see an exception if the setting protects you...Here I meant that one default setting like
1miowould not make CH safer at the same time as there you have just a few K nodes.arminus commentedon Jun 6, 2016
routing.max_visited_nodes on 0.6 doesn't have any effect either - I'll try with the master later. Can it load the 0.6 DB?
karussell commentedon Jun 6, 2016
on 0.6 it should be
routing.maxVisitedNodes. Also have a look into the json response, there you see how many visited nodes you have and can just use a bit lower value (restart necessary) to see if it throws an exception.arminus commentedon Jun 9, 2016
Ok, this does work in the master branch (java.lang.IllegalArgumentException: No path found due to maximum nodes exceeded...) with routing.max_visited_nodes but I get no such exception when setting routing.maxVisitedNodes in 0.6
karussell commentedon Jun 9, 2016
Strange. Still we won't have the time to fix this in 0.6 as 0.7 will be out next week ...
arminus commentedon Jun 9, 2016
That's fine, I also spent almost half the day yesterday to prevent routing in case line of sight dist > some max value on the client side (which will not be entirely in vain once I have 0.7 since it also now properly cancels waypoint drags etc.)
karussell commentedon Jun 9, 2016
Regarding the "dist > some max value" I've created a new issue: #734
INRIX-Trang-Nguyen commentedon Mar 31, 2020
We have been running into memory and performance issues related to this issue.
At scale, we set a large value for maxVisitedNodes to enable routing against sparse data set.
Are there any improvements planned to map matching to detect cyclical graph traversal and prevent infinite loop without having to rely on maxVisitedNodes? It seems that an edge should not be traversed more than once or have a way to configure the number of re-traversals allowed.