<p dir="ltr">I guess a more time consuming parameter is the number of vertex in the feature involved in the map rather than the layer numbers.</p>
<p dir="ltr">A.<br>
</p>
<div class="gmail_quote">Il 22 apr 2016 3:27 PM, "Jörg Habenicht" <<a href="mailto:jh@mwerk.net">jh@mwerk.net</a>> ha scritto:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Andreas, dear list,<br>
<br>
sorry for the warm up of this old topic.<br>
<br>
There is in deed a need to enable multi threading in Qgis-Server.<br>
<br>
In our company we use around 60 different layer to lay some topics on<br>
the map. This may be an extreme example to read, but quite common in our<br>
environment, i.e. we can not lower this number significantly.<br>
<br>
A warmed up QGis-Server process which already read and cached the<br>
Configuration file qgis-xy.conf still needs around 20 seconds to<br>
calculate the complete resulting map picture.<br>
<br>
During this calculation there is only one thread working, serializing<br>
the DB-requests, calculation the layer picture and mapping the picture<br>
on the resulting picture.<br>
The process is running on a multi core server. If we can utilize the<br>
idle cores to do useful work, this can be an easy example to speed up<br>
the process (significant).<br>
<br>
I'd like to share my developing experience to do this change, but I<br>
would need further information and some support to do some useful patches.<br>
<br>
I have scanned the git-Qgis sources (commit<br>
81744ecf90a8f6c1e2e94fdacb07e3dca6987dcc) for a suitable multithreading<br>
entry. Found QgsMapRenderer::render() because of the line "while (<br>
li.hasPrevious() )". It seems in this loop the layers are painted in<br>
serial onto the resulting picture.<br>
If I can build an auto parallel computing with QtConcurrent in this<br>
place there seems to be the most gain. I mean to parallelize the loop<br>
with concurrent DB requests, concurrent painting in separate pictures<br>
and in serial map the single pictures onto the result picture.<br>
<br>
Right now I don't know if I can do DB requests in parallel, or where the<br>
code for database requests is buried.<br>
And how about the calls inside the loop, are there side effects<br>
preventing multi threading?<br>
<br>
<br>
Do you got hints, flames or suggestions?<br>
<br>
<br>
cu<br>
Jörg<br>
<br>
<br>
Am 23.02.2016 um 16:39 schrieb Neumann, Andreas:<br>
> Hi Régis,<br>
><br>
> QGIS server is single-threaded. You can't simply turn on multi-threaded<br>
> rendering in QGIS server. The other issue is that each Apache FCGI<br>
> process has it's own set of cache. So if you have 5-10 parallel Apache<br>
> threads or processes each thread/process has it's own cache. If your<br>
> client hits a thread that has the cache unititialized you will have wait<br>
> longer until this cache is fillled.<br>
><br>
> I once asked Marco whether one could<br>
><br>
> a) have a shared cache for all Apache threads or processes<br>
<br>
There is no shared cache, because Apache spawns QGis-Processes with its<br>
own memory layout. these Processes know nothing about its neighbor, and<br>
you have a hard time to exchange data between all processes.<br>
How about a scheduler, which assigns requests to warmed up Qgis-processes?<br>
<br>
><br>
> b) support multi-threaded rendering<br>
><br>
> But he said it would be very complicated to implement a) and b), if not<br>
> impossible. Maybe other devs have other views. Note that was about 2<br>
> years ago, when I last discussed this with Marco.<br>
><br>
> ---------------------<br>
><br>
> Nevertheless I believe there would be room for performance improvements<br>
> in QGIS server - if interested parties share their efforts (be it dev<br>
> time or financial resources).<br>
><br>
[snip]<br>
><br>
> Andreas<br>
><br>
[snip]<br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Qgis-developer mailing list<br>
> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
><br>
<br>
--<br>
<br>
mWerk GmbH<br>
Dipl.-Ing. Jörg Habenicht<br>
Landwehrstr. 76<br>
30519 Hannover<br>
(T) <a href="tel:%2B49%20511%209999%208033" value="+4951199998033">+49 511 9999 8033</a><br>
(F) <a href="tel:%2B49%20511%209999%208041" value="+4951199998041">+49 511 9999 8041</a><br>
(E) <a href="mailto:jh@mwerk.net">jh@mwerk.net</a><br>
Amtsgericht Hannover HRB 206522<br>
Geschäftsführer<br>
Reiner Brachvogel<br>
Dennis Kornehl<br>
_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div>