Opened 12 years ago
Closed 12 years ago
#7914 closed enhancement (fixed)
[PATCH] Concurrent fetching of primitives
Reported by: | Don-vip | Owned by: | team |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Core | Version: | |
Keywords: | performance, multithread, multicore | Cc: |
Description (last modified by )
The OSM API usage policy allows us to use 2 download threads:
http://wiki.openstreetmap.org/wiki/API_usage_policy#Technical_Usage_Requirements
I have achieved to improve dramatically the performances in fetching a large number of primitives (I used as example the multipolygon 1155338 which contains more than 12k nodes). With this patch, download time fell from 3min50s to 1min42s on my machine !
However, I'd like to have some code review and some testing before committing.
I am particularly afraid of the handling of ProgressMonitor. I was expecting to get some ConcurrentModificationExceptions. I did not get any problem, but I don't know if I was lucky or if the code is OK :)
Attachments (1)
Change History (8)
by , 12 years ago
Attachment: | 7914.patch added |
---|
comment:1 by , 12 years ago
Description: | modified (diff) |
---|
follow-up: 5 comment:2 by , 12 years ago
comment:3 by , 12 years ago
Please, as we now have online Javadoc - new code should be completely documented and doc-error free. And in the same run doc errors in modified files can be fixed :-)
BTW: Improving download time is good...
comment:4 by , 12 years ago
Replying to bastiK:
I like this... :)
Thanks :)
Even users with a single processor machine would benefit, see e.g. this explanation.
OK so I'll test on my old laptop, with a single core processor, to see it's better. If yes, I'll remove the check on the number of processors.
ProgressMonitor should be safe for multi-threading, it uses synchronized methods throughout.
Great ! :)
I noticed, after cancel it closes the dialog window, but the downloads go on in the background.
Yep. Fix on the way.
We should keep in mind, that the API usage policy might change at any time. Let's hope, if that happens, they implement it in such a way that the second connection gets queued and not rejected.
I have a better idea on this: https://trac.openstreetmap.org/ticket/4501
Still, it might be a good idea to make the number of connections user configurable.
Agreed.
Replying to stoecker:
new code should be completely documented and doc-error free. And in the same run doc errors in modified files can be fixed :-)
Sir, yes sir ! :)
I like this... :)
Even users with a single processor machine would benefit, see e.g. this explanation.
ProgressMonitor should be safe for multi-threading, it uses synchronized methods throughout.
I noticed, after cancel it closes the dialog window, but the downloads go on in the background.
We should keep in mind, that the API usage policy might change at any time. Let's hope, if that happens, they implement it in such a way that the second connection gets queued and not rejected. Still, it might be a good idea to make the number of connections user configurable.