Replies: 4 comments 9 replies
-
Hey, have you tried doing PyValhalla not in parallel? Launching processes in Python is very costly for such a short operation. Multithreading is better I find for this kind of thing but potentially just doing it sequentially will outperform the docker method anyway |
Beta Was this translation helpful? Give feedback.
-
Apart from Python being pretty much unusable for parallelizing (threading won’t work here I believe, we don’t release the GIL in the C++ component), did you try a 1:many matrix? Do you really need all the 100 results or you just need e.g. the 10 most optimal ones? The latter would exorbitantly speed up matrix computation. |
Beta Was this translation helpful? Give feedback.
-
ah yes you're right about the threading, I forgot what I did previously. You can use multiprocessing but not for one route at a time. you'd need to put them into chunks of enough routes (enough to cover several seconds per process probably) to cover the overheads for setup and tear down of the processes. The matrix one just finds the times right? I would've expected finding routes would mean wanting to see the routes |
Beta Was this translation helpful? Give feedback.
-
@nilsnolde I've had a look at the matrix geometry. If I do a sources_to_targets expansion, can I also get the total times to reach a particular edge? I don't want to run it twice needlessly. In fact, does the matrix endpoint return the times for each segment? That way if you use it for routing you would be able to know how long to reach each segment in your navigation edit: can either matrix or expansion matrix get the full picture? maybe there is a parameter I'm missing |
Beta Was this translation helpful? Give feedback.
-
For my project, I need an open-source routing engine that can find the best route for up to 100 endpoints to a fixed start point. The engine should be able to process dynamic routing information (e.g., traffic data) as fast as possible. Since Valhalla seems to be a better choice compared to OSMR, I tested its performance to determine its suitability.
On my PC, I observed that the average response time performance is actually better when using it with Docker via HTTP. I am wondering if I made a mistake in my measurements. I created a Python script that extracts 100 endpoints from a coordinate.txt file and calls the PyValhalla library for each endpoint separately. I have attached the script for your reference:
measure_script.txt.
The results from PyValhalla were as follows:
However, when I tested the API with a self-hosted Docker image and processed the same set of coordinates (with the same values), I obtained the following results:
I made a visual studio project for the api test. The files can be seen here: https://gist.github.com/Hendriksn/2e3ead62c5dcf3f9fcd65b2cea0a06af
The coordinates that are used for my performance test are from germany.
Start point: lat: 52.678092, lon: 11.112545
Endpoints can be seen here they are all for up to 100km away from the start point:
coordinates 0-100.txt
I ensured that the coordinates were processed in parallel in both testing environments. As a requirement, the routing engine should process this number of requests in less than two seconds. I wonder if something is wrong with my measurements. Could anyone provide insights or suggestions?
Beta Was this translation helpful? Give feedback.
All reactions