[Qgis-developer] QGIS Server does not release files after each request - OGROpenShared instead of OGROpen ?

kimaidou kimaidou at gmail.com
Wed Sep 16 01:19:43 PDT 2015


Hi all

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.

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.
The following commit fixes it :
https://github.com/qgis/QGIS/commit/a5450a78ffcbba9a75afa8be43460ad741fea050

It has been backported in branches release-2_8 and release-2_10

A very good side effect is with PostGIS layers :
* 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" )
* now only the main "get data" queries are sent for each GetMap, like [3]

In [2], you can see some performance kiling queries (on big datasets), such
as

SELECT count(distinct ""nb"")=count(""nb"") FROM (SELECT row_number()
OVER() AS nb, * FROM ""2013"".v_geo_parcelle
) AS ""subQuery_0"""

SELECT st_extent(""geom"") FROM (SELECT row_number() OVER() AS nb, * FROM
""2013"".v_geo_parcelle
) AS ""subQuery_0""

[1] https://paste.sh/yguqyRWL#EPcHHVH3uuijGgEtzH0pAlHb
[2] https://paste.sh/frCglZ9A#A1nQ6BXtdBeEiZWQmTJP8v9l
[3] https://paste.sh/Rkvqf757#K1MCRitovIxMblBVils1VF7r


Thanks a lot to René-Luc for fixing this !

Cheers
Michaël

2015-09-14 8:39 GMT+02:00 Luca Manganelli <luca76 at gmail.com>:

> On Fri, Sep 11, 2015 at 5:09 PM, kimaidou <kimaidou at gmail.com> wrote:
> > I tested a quick and dirty patch, by replacing all occurences of OGROpen
> byt
> > OGROpenShared in QGIS source, then rebuild and test server side --> No
> locks
> > anymore ! QGIS Server works like a charm here, without increasing the
> number
> > ...
>
> This is a great fix! It's important to optimize resources, expecially
> with qgis server.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150916/3dfa9285/attachment-0001.html>


More information about the Qgis-developer mailing list