<div dir="ltr"><div><div><div><div><div><div><div>Hi all<br><br></div>René-Luc has found why this appeared, essentially with Lizmap. Lizmap send GetMap request to QGIS Server with a non empty STYLES parameter (ex: STYLES=default). This is to let the user choose the style.<br><br></div>In this case, QGIS Server did not use the maplayer cache, so it had to get all information from the provider to build the maplayer objet for each GETMAP request ! This is why in this case, a new opening was made on the file.<br></div>The following commit fixes it : <br><a href="https://github.com/qgis/QGIS/commit/a5450a78ffcbba9a75afa8be43460ad741fea050">https://github.com/qgis/QGIS/commit/a5450a78ffcbba9a75afa8be43460ad741fea050</a><br><br></div>It has been backported in branches release-2_8 and release-2_10<br><br></div>A very good side effect is with PostGIS layers :<br></div>* before, QGIS Server sent many many queries to build the whole maplayer for each GetMAP, such as : [1] if metadata were available, and worse like [2] if metadata were not (for example for PostGIS views or if the user had disabled "use metadata" )<br></div>* now only the main "get data" queries are sent for each GetMap, like [3]<br><div><br></div><div>In [2], you can see some performance kiling queries (on big datasets), such as <br><br>SELECT count(distinct ""nb"")=count(""nb"") FROM (SELECT row_number() OVER() AS nb, * FROM ""2013"".v_geo_parcelle<br>
) AS ""subQuery_0"""<br>
<br>SELECT st_extent(""geom"") FROM (SELECT row_number() OVER() AS nb, * FROM ""2013"".v_geo_parcelle<br>
) AS ""subQuery_0""<br></div><div><br>[1] <a href="https://paste.sh/yguqyRWL#EPcHHVH3uuijGgEtzH0pAlHb">https://paste.sh/yguqyRWL#EPcHHVH3uuijGgEtzH0pAlHb</a><br>[2] <a href="https://paste.sh/frCglZ9A#A1nQ6BXtdBeEiZWQmTJP8v9l">https://paste.sh/frCglZ9A#A1nQ6BXtdBeEiZWQmTJP8v9l</a><br>[3] <a href="https://paste.sh/Rkvqf757#K1MCRitovIxMblBVils1VF7r">https://paste.sh/Rkvqf757#K1MCRitovIxMblBVils1VF7r</a><br><br><br></div><div>Thanks a lot to René-Luc for fixing this !<br><br></div><div>Cheers<br></div><div>Michaël<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-14 8:39 GMT+02:00 Luca Manganelli <span dir="ltr"><<a href="mailto:luca76@gmail.com" target="_blank">luca76@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Sep 11, 2015 at 5:09 PM, kimaidou <<a href="mailto:kimaidou@gmail.com">kimaidou@gmail.com</a>> wrote:<br>
> I tested a quick and dirty patch, by replacing all occurences of OGROpen byt<br>
> OGROpenShared in QGIS source, then rebuild and test server side --> No locks<br>
> anymore ! QGIS Server works like a charm here, without increasing the number<br>
</span>> ...<br>
<br>
This is a great fix! It's important to optimize resources, expecially<br>
with qgis server.<br>
_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div><br></div>