<div dir="ltr"><div><div><div><div>Hi Philipp ,<br><br></div>You can take a look at the link below .<br><a href="https://github.com/pgRouting/pgrouting/wiki/Details-and-how-to-use-guide-.">https://github.com/pgRouting/pgrouting/wiki/Details-and-how-to-use-guide-.</a><br>
<br> The pgr_pastar function doesnt load the whole graph initially , instead it loads only the partition that is required by the path computation algorithm. This was developed as a gsoc project this year keeping in mind the problem related with very large network. The thing is that it hasn't been tested very extensively so it hasn't been yet included with the pgrouting package , you can still use it using the above link , it has all the useful infomation regarding its installation and other pre-processing stuffs.<br>
<br></div>Hope this helps .<br><br></div>- <br></div>mukul <br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 25, 2013 at 8:44 PM, Stephen Woodbridge <span dir="ltr"><<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Postgresql is very good at page management and caching pages which is why you are probably not seeing a huge performance pick up. Many of the newer raid controllers have the option of add SSD for caching to optimize reading and handling write backs to spinning disks. Since pgRouting is mostly a build once, then read mostly read it might benefit from this in the reading of the edges.<br>
<br>
But, in addition to reading the edges, allocate huge arrays to load all the edges into memory, then we still have to build the graph with those edges which requires allocating more memory and writing all the edges into that, then free the edge array all of which is also a big cost.<br>
<br>
So the ideal situation is to build it once and reuse it if possible.<br>
This is a little complicated in that you have to make sure that the graph and intermediate structures all get reinitialized.<br>
<br>
Or hold the array of edges if we have to rebuild the graph multiple time. This is fairly trivial to implement.<br>
<br>
-Steve W<div class="HOEnZb"><div class="h5"><br>
<br>
On 10/25/2013 10:26 AM, Stephen V. Mather wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In our experience with this, just getting a few SSDs in a RAID solves<br>
the performance issues of large networks, but it may be similar cost<br>
to pay for the dev work Stephen highlights below, and would benefit<br>
everyone.<br>
<br>
In theory, on the OS level, you could have the database pointed at a<br>
logical disk which is really just memory, but then you need to deal<br>
with persistence issues, and reboot, etc., but it's not a difficult<br>
problem space. I can't find it at the moment, but I think we had a<br>
pgRouting mailing list discussion about this within the last year, so<br>
you might look to that as well.<br>
<br>
Best, Steve<br>
<br>
Stephen V. Mather GIS Manager (216) 635-3243 (Work)<br>
<a href="http://clevelandmetroparks.com" target="_blank">clevelandmetroparks.com</a><br>
<br>
<br>
<br>
<br>
______________________________<u></u>__________ From:<br>
<a href="mailto:pgrouting-users-bounces@lists.osgeo.org" target="_blank">pgrouting-users-bounces@lists.<u></u>osgeo.org</a><br>
[<a href="mailto:pgrouting-users-bounces@lists.osgeo.org" target="_blank">pgrouting-users-bounces@<u></u>lists.osgeo.org</a>] on behalf of Stephen<br>
Woodbridge [<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a>] Sent: Friday, October 25, 2013<br>
10:08 AM To: <a href="mailto:pgrouting-users@lists.osgeo.org" target="_blank">pgrouting-users@lists.osgeo.<u></u>org</a> Subject: Re:<br>
[pgrouting-users] Speed when using big maps<br>
<br>
On 10/25/2013 4:49 AM, Philipp Hamm wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Thanks Steve! But I still have some questions:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
To understand this I have some questions about how pgRouting<br>
works: Does pgRouting reloads the road data on every request<br>
and does the slow calculation results only from fetching the<br>
graph? If so, is it possible to load the graph into the memory<br>
and reuse it for further requests?<br>
</blockquote>
<br>
No, not currently because there is no place to load the graph<br>
into memory in the database that is persistent.<br>
</blockquote>
<br>
What do you mean? Is there not enough space on the RAM for the<br>
whole road network?<br>
</blockquote>
<br>
pGRouting runs as a postgresql database extension, which means we<br>
have to play within the rules and constraints of extensions to the<br>
database.<br>
<br>
The database lives effectively forever in memory and it would not be<br>
nice to other users if we just grabbed a huge chunk of memory. What<br>
would happen if 10 or 100 users all grabbed a huge chunk. Then there<br>
is another issue of how long do we hold the memory?, what if the<br>
user forgets to free the memory? what happens if someone restarts<br>
the database how do we know if we have to reload the graph, etc, etc,<br>
etc<br>
<br>
All of the current commands have a lifespan of the query. everything<br>
gets done in a single query and everything is released at the end of<br>
the query.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And does "not currently" mean that someone is working on that? ;)<br>
Or are there any ideas and hints to achieve that? Because the most<br>
recent posting I've found about that is this one:<br>
<a href="http://lists.osgeo.org/pipermail/pgrouting-users/2012-December/001379.html" target="_blank">http://lists.osgeo.org/<u></u>pipermail/pgrouting-users/<u></u>2012-December/001379.html</a><br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote>
No, there are some ideas bouncing around, but mostly these focus on<br>
things like the kdijkstra one to many. It would be possible to do a<br>
many to many, using kdijstra like code the builds the graph once, and<br>
then solve multiple kdijkstra solutions on it. This would be a good<br>
project for a programmer that want to contribute to pgRouting with a<br>
pull request. Or if there is some funding we would be happy to<br>
tackle something like this.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As I want to execute a lot of kDijkstras consecutively I guess<br>
only bounding boxes won't make it fast enough.<br>
</blockquote>
<br>
If you need many routes from a single start point, then you<br>
should look at pgr_kdijkstra().<br>
</blockquote>
<br>
Yes, this is what I am going to do. But in fact I want to calculate<br>
a many-to-many matrix. So I have to run the one-to-many Dijkstra n<br>
times, which would cause a huge waste of time when rebuilding the<br>
graph n times<br>
</blockquote>
<br>
Yes, I understand as I mentioned above and opened:<br>
<a href="https://github.com/pgRouting/pgrouting/issues/205" target="_blank">https://github.com/pgRouting/<u></u>pgrouting/issues/205</a><br>
<br>
Regards, -Steve<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Regards, Philipp<br>
<br>
<br>
<br>
-----Ursprüngliche Nachricht----- Von:<br>
<a href="mailto:pgrouting-users-bounces@lists.osgeo.org" target="_blank">pgrouting-users-bounces@lists.<u></u>osgeo.org</a><br>
[mailto:<a href="mailto:pgrouting-users-bounces@lists.osgeo.org" target="_blank">pgrouting-users-<u></u>bounces@lists.osgeo.org</a>] Im Auftrag von<br>
Stephen Woodbridge Gesendet: Donnerstag, 24. Oktober 2013 15:04<br>
An: <a href="mailto:pgrouting-users@lists.osgeo.org" target="_blank">pgrouting-users@lists.osgeo.<u></u>org</a> Betreff: Re: [pgrouting-users]<br>
Speed when using big maps<br>
<br>
On 10/24/2013 6:16 AM, Philipp Hamm wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi everyone,<br>
<br>
I've just started testing pgRouting on a big network (Germany)<br>
and want to use the whole Europe map later, but it's pretty slow.<br>
I takes around 2,5 min to calculate one route and it makes no<br>
difference if the route distance is 7km or 700km.<br>
<br>
Is there anything I can do to speed it up? I have already<br>
indices to 'source' and 'target' and id is primary key, but I<br>
don't know how to use bounding boxes.<br>
</blockquote>
<br>
You need to create a spatial index:<br>
<br>
create index myroads_gidx on myroads using gist (the_geom);<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Furthermore I've noticed: when selecting only a part of the<br>
graph (keeping in mind that the area of the dijkstra expansion is<br>
loaded) it gets much faster. Is this similar to what the bounding<br>
box would do?<br>
</blockquote>
<br>
Then only load the part of the roads needed to solve the graph.<br>
The more roads you load the long it takes to load the data and to<br>
solve the problem. Also astar and trsp are both faster then<br>
Dijkstra.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
To understand this I have some questions about how pgRouting<br>
works: Does pgRouting reloads the road data on every request and<br>
does the slow calculation results only from fetching the graph?<br>
If so, is it possible to load the graph into the memory and reuse<br>
it for further requests?<br>
</blockquote>
<br>
No, not currently because there is no place to load the graph into<br>
memory in the database that is persistent.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As I want to execute a lot of kDijkstras consecutively I guess<br>
only bounding boxes won't make it fast enough.<br>
</blockquote>
<br>
If you need many routes from a single start point, then you should<br>
look at pgr_kdijkstra().<br>
<br>
If your routes are long and you want to use highways, then you can<br>
load data like a barbell using three bbox queries and union the<br>
results together. So, query 1, gets all roads for some radius<br>
around the start point, query2, gets all roads for some radius<br>
around the end point, and query 3, gets all the highways only in<br>
the bounding box between the start and end points.<br>
<br>
-Steve<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks in advance!<br>
<br>
<br>
<br>
______________________________<u></u>_________________ Pgrouting-users<br>
mailing list <a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.<u></u>org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-<u></u>users</a><br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________ Pgrouting-users<br>
mailing list <a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.<u></u>org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-<u></u>users</a><br>
______________________________<u></u>_________________ Pgrouting-users<br>
mailing list <a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.<u></u>org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-<u></u>users</a><br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________ Pgrouting-users<br>
mailing list <a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.<u></u>org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-<u></u>users</a><br>
<br>
<br>
______________________________<u></u>_________________ Pgrouting-users<br>
mailing list <a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.<u></u>org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-<u></u>users</a><br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org" target="_blank">Pgrouting-users@lists.osgeo.<u></u>org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-<u></u>users</a><br>
</div></div></blockquote></div><br></div>