lizmap-web-client icon indicating copy to clipboard operation
lizmap-web-client copied to clipboard

[Question]: Make communication faster between LWC and QGIS Server

Open Oxsw1ng opened this issue 1 year ago • 16 comments

What is the question? (in English)

My LWC is very slow when it communicates with QGIS (each zoom or movement on the map).
So I wanted to try to compare a project, Tram in Montpellier hosted on the Lizmap demo website, and the other project is hosted on my server. I was looking for the Networks Webtool to compare the two projects on the QGIS Server communication. I was trying to move and zoom in and out to get the maximum of requests.

Here is what I get for the project hosted on the Lizmap demo website : image

And here is what I get on my website : image

We can see that there is more requests on my website and that the green stripes are longer. Those details leads to slow performances on my website (these applies to all other projects). So, I dont know if this can be explained.

More details about my LWC

Multi-threading is activated On the machine which hosts LWC, I have 1 CPU with 8 cores and 4GB RAM.

Versions, safeguards, check summary etc

Versions :

  • Lizmap Web Client : 3.7.6
  • Lizmap plugin : 4.3.15
  • QGIS Desktop : 3.22.16
  • QGIS Server : 3.22.16
  • Py-QGIS-Server : not used
  • QGIS Server plugin atlasprint : not found
  • QGIS Server plugin lizmap_server : 2.9.0
  • QGIS Server plugin wfsOutputExtension : not found
List of safeguards :
  • Mode : safe
  • Allow parent folder : no
  • Prevent other drive : yes
  • Prevent PG service : yes
  • Prevent PG Auth DB : yes
  • Force PG user&pass : yes
  • Prevent ECW : yes

Check Lizmap plugin

  • [ ] I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket. Otherwise, my ticket is not considered valid and might get closed.

Operating system

Debian 12

Browsers

Firefox

Browsers version

Firefox 126

Relevant log output

No response

Oxsw1ng avatar Jun 13 '24 07:06 Oxsw1ng

@Oxsw1ng It would be interesting to know what versions of LMWC/QGIS Server/etc are used in LMWC demo server, but as a start I would say that you should try with QGIS Server/Desktop 3.34 as there is no point in keeping use an EOL version of QGIS (also 3.34 is basically mandatory for LMWC 3.7+ work as expected).

gioman avatar Jun 16 '24 09:06 gioman

@gioman Is there a QGIS Server 3.34 ? Because when I install it on my Debian machine, it tells me thats 3.22 is the latest version of QGIS Server

Oxsw1ng avatar Jun 17 '24 06:06 Oxsw1ng

Each version of QGIS Server is available, at each new monthly release of QGIS https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule

On the demo server, it's still 3.28, but I think we will switch to QGIS 3.34 this week.

Gustry avatar Jun 17 '24 08:06 Gustry

@Gustry I've tried to switch to QGIS Server 3.36, and it doesn't seem to change a lot of things :/ In fact, my map (OSM) doesn't show up anymore

Oxsw1ng avatar Jun 17 '24 13:06 Oxsw1ng

Is it blank tiles ? What is the status code of your tiles in your web browser ? What are QGIS Server logs (with enough verbosity if necessary) when rendering your tiles ? Is the OSM layer called straight from the OSM server or going through QGIS Server in between.

Gustry avatar Jun 17 '24 13:06 Gustry

Yes, it's blank tiles. I went through my log file and it tells me than cache directory is not accessible. Maybe I need to reconfigure cache directory. The OSM comes from the lizmap base layers, so I guess it's directly called staright from the OSM Server.

Oxsw1ng avatar Jun 17 '24 14:06 Oxsw1ng

The OSM comes from the lizmap base layers, so I guess it's directly called staright from the OSM Server.

So if it's straight from the OSM server, then QGIS Server is not used (and then not the cache directory as well).

Gustry avatar Jun 17 '24 14:06 Gustry

So what do I need to check in Lizmap plugin ? Single tile and check WMS ?

Oxsw1ng avatar Jun 17 '24 14:06 Oxsw1ng

Because now I dont have logs or console logs anymore. It's just blank and I cant do nothing about it.

Oxsw1ng avatar Jun 17 '24 14:06 Oxsw1ng

@Gustry there are some general questions (maybe issues) regarding caching that did not had much traction/attention lately, see https://github.com/3liz/lizmap-web-client/issues/4511 and/or https://github.com/3liz/lizmap-web-client/issues/3696

gioman avatar Jun 18 '24 10:06 gioman

thanks!

gioman avatar Jun 18 '24 10:06 gioman

an example, the same project with an abysmal difference time loading: qgis server 3.28.15/LWC 3.6.16-pre - 1,28 s qgis server 3.28.15/LWC 3.7.9-pre - 1,37 minutes (first time) imagem qgis server 3.28.15/LWC 3.7.9-pre - 1,28 s (second time and subsequent times)

josemvm avatar Jun 18 '24 21:06 josemvm

@josemvm So what the solution can be ? If it's due to LWC version, I need to try every version to see which one is the quickest. And is that difference of time of requests processing between two versions of LWC is explainable?

Oxsw1ng avatar Jun 19 '24 07:06 Oxsw1ng

@Oxsw1ng

The OSM comes from the lizmap base layers, so I guess it's directly called staright from the OSM Server.

So if it's straight from the OSM server, then QGIS Server is not used (and then not the cache directory as well).

What I mean if tiles are straight from the OSM server, then issue is very different if tiles are from QGIS server (even if serving OSM tiles). The button from the plugin to add an OSM layer makes a call straight to OSM server, not using your QGIS server on purpose.

You can see that in your "Request" tab of your web browser.

stateDiagram-v2
    osm : OSM server
    qgis: QGIS Server
    webbrowser: WebBrowser
    osm --> qgis
    qgis --> webbrowser
    osm --> webbrowser

If it's blank tiles from QGIS Server, please check QGIS server logs.

@josemvm Quite surprising indeed. Please provide some logs of QGIS Server, to see the time of QGIS Server when receiving the request and when QGIS Server send back the data. LWc is mainly transfering the data from QGIS Server to the frontend, strange. There are some logic to replace some strings, server settings etc, ACL checks, but still not normal.

@gioman Your issues are not related to this ticket I think.

Gustry avatar Jun 19 '24 12:06 Gustry

@josemvm Quite surprising indeed. Please provide some logs of QGIS Server, to see the time of QGIS Server when receiving the >request and when QGIS Server send back the data. LWc is mainly transfering the data from QGIS Server to the frontend, strange. >There are some logic to replace some strings, server settings etc, ACL checks, but still not normal.

@Gustry i can provide an url if want to inspector. let me know. thanks

josemvm avatar Jun 19 '24 14:06 josemvm

@josemvm QGIS server logs are server side, not client side. With a URL, we can mainly inspect your screenshot above.

Gustry avatar Jun 19 '24 14:06 Gustry

This issue is missing some feedbacks. 👻 Please have a look to the discussion, thanks. 🦎

github-actions[bot] avatar Jul 22 '24 14:07 github-actions[bot]

@josemvm So what the solution can be ? If it's due to LWC version, I need to try every version to see which one is the quickest. And is that difference of time of requests processing between two versions of LWC is explainable?

It would need further investigation but it seems your issue comes from GetLegendGraphic request... It happens with every LWC version > 3.6, with any QGis server version... this issue is experienced by many users (see for example #4750 or #4521) and does not have a solution to this day as far as I know.

SecondGIS avatar Jan 16 '25 08:01 SecondGIS

It would need furhter investigation but it seems your issue comes from GetLegendGraphic request... It happens with every LWC version > 3.6, with any QGis server version... this issue is experienced by many users (see for example #4750 or #4521) and does not have a solution to this day as far as I know.

@SecondGIS it is inedeed the getlegendgraphic requests that are slowing things down. This has been pointed and discussed in a few other tickets. In my opinion new legends should be pre-generated by the plugin and uploaded to the server (so LMWC will not have to do any request) along with the .cfg file, cached by LMWC or both, possibly also with an option to opt out of the new legends at a project level and make LMWC request the old legends in PNG format.

gioman avatar Jan 16 '25 14:01 gioman