-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
pgr_trsp not fast enough at short distances #219
Comments
Long distance routes are particularly difficult performance wise because we need to load two many edges in the bounding box. Loading the graph costs more than solving it but this is a know limitation for the flexibility of being able to dynamically define your graph. There are a few strategies for dealing with some of these performance problems:
If you are interested in jumping into the code, we would welcome pull requests that address performance issues. I have some ideas so talk with me about your ideas. Or add your ideas here. |
Thank you for your detailed answer. Regarding the strategies you advised:
I am not good at c++, I will better stick to just reading the code :) I just feel that something isn't right if there is a good and probably fast algorithm and loading data from a database (which is exactly for that: providing fast data access) takes way too long. Thanks. |
OSRM is faster when you graph is static. For example you build it once and the costs do not change, you do not need to change from short distance to shortest time, and probably most important for you is that is only supports simple 3 node restrictions, like from_node, via_node, to_node, if you need more complex restrictions you need to wait until that gets added. OSRM has a lots of costly preprocessing that has to happen that makes it fast to extract the route. And FYI, I am writing a package that will allow pgrouting users to access a local OSRM server via plpgsql wrappers. Update see: https://github.com/woodbri/osrm-tools |
To better understand how pgRouting works (and hence some of its limitations, here is the general flow of what happens when you run any of our solver algorithms:
Step 5. is probably the fastest step, steps 1-4 take most of the time. We have lots of constraints working inside the database. The database gives us lots of benefits like flexibility, storage management, portability, easy integration with other tools, etc. But all this generalization and flexibility comes at a cost that we will not have the performance of a specific purpose built application that does one thing very well and fast, but can not easily be changed to do something else. I'm inclined to close this as I'm not sure that it is a fixable issue. If you have a more specific issue like: If I run query A it is fast but query B is slow and should be on par with A, or something more concrete. |
This is more a request for information than a bug. I'll tag it as Documentation for now as we might want to provide some additional information about performance and OSRM and OSRM-Tools in our documentation. |
Work has been done for TRSP on develop branch for version 3.4 (due to be released on September/October 2022: For further similar problems with TRSP functions please open a new issue with the specific function name |
I have read that the running time of the Dijkstra based algorithms at short distances (e.g. 0-10 km) is less with an order of several magnitudes than at large distances (e.g. 100-500km).
However, with pgr_trsp (or pgr_dijkstra) I cannot reproduce that. I experience that fetching the data for the function's first parameter takes the majority of running time and properly filtering those data is a difficult thing on a 5 million edge count graph.
With some kind of filtering I could reach a running time of several hundred milliseconds at short distances and one or max two orders of magnitude more at long distances but I think it can be much less. I feel somehow that something is wrong. It seems that there is a good and fast algorithm but when we plug it into Postgresql, then the whole data thing messes up everything.
Do you have a proper method for filtering the graph?
What running times do you have in different circumstances? What was the minimum?
Do I use the pgRouting functions wrong or it is normal behaviour?
Thanks in advance.
The text was updated successfully, but these errors were encountered: